diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-12 22:17:21 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-12 22:24:27 -0800 |
| commit | 0616cba62be78082f10f6673d45ba4d94da423dc (patch) | |
| tree | 0cd1d0cf9434a751b293b8292da1c153065da491 /src/rt/rust_kernel.cpp | |
| parent | dcac427795285a46232722a38e8a5f88ae4dc891 (diff) | |
| download | rust-0616cba62be78082f10f6673d45ba4d94da423dc.tar.gz rust-0616cba62be78082f10f6673d45ba4d94da423dc.zip | |
libcore: Add sys::set_exit_status
Sets the process exit code
Diffstat (limited to 'src/rt/rust_kernel.cpp')
| -rw-r--r-- | src/rt/rust_kernel.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 3078f6b78c4..a7e4ee2e450 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -11,8 +11,8 @@ rust_kernel::rust_kernel(rust_srv *srv, size_t num_threads) : _log(srv, NULL), srv(srv), max_id(0), - num_threads(num_threads), rval(0), + num_threads(num_threads), live_tasks(0), env(srv->env) { @@ -140,6 +140,7 @@ rust_kernel::fail() { // FIXME: On windows we're getting "Application has requested the // Runtime to terminate it in an unusual way" when trying to shutdown // cleanly. + set_exit_status(PROC_FAIL_CODE); #if defined(__WIN32__) exit(rval); #endif @@ -210,6 +211,15 @@ rust_kernel::win32_require(LPCTSTR fn, BOOL ok) { } #endif +void +rust_kernel::set_exit_status(int code) { + scoped_lock with(_kernel_lock); + // If we've already failed then that's the code we're going to use + if (rval != PROC_FAIL_CODE) { + rval = code; + } +} + // // Local Variables: // mode: C++ |
