diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-04 14:54:10 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-08 15:33:40 -0800 |
| commit | f39e64d56ab4929be5985d4a64020d2223706d96 (patch) | |
| tree | 0c3c810c87372216986d47eadd9476a0d9150117 /src/rt/rust_kernel.h | |
| parent | 6eafe5d772131c644a40ae1013a6016dcba037c4 (diff) | |
| download | rust-f39e64d56ab4929be5985d4a64020d2223706d96.tar.gz rust-f39e64d56ab4929be5985d4a64020d2223706d96.zip | |
rt: Change the scheme used for terminating the kernel
Instead of joining on the scheduler threads, instead keep a count of active schedulers. When there are no more schedulers raise a signal for the main thread to continue. This will be required once schedulers can be added and removed from the running kernel.
Diffstat (limited to 'src/rt/rust_kernel.h')
| -rw-r--r-- | src/rt/rust_kernel.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h index 047cd73bf03..9a59a35e908 100644 --- a/src/rt/rust_kernel.h +++ b/src/rt/rust_kernel.h @@ -35,6 +35,13 @@ private: lock_and_signal rval_lock; int rval; + // Protects live_schedulers + lock_and_signal sched_lock; + // Tracks the number of schedulers currently running. + // When this hits 0 we will signal the sched_lock and the + // kernel will terminate. + uintptr_t live_schedulers; + public: struct rust_env *env; @@ -53,6 +60,8 @@ public: int start_schedulers(); rust_scheduler* get_default_scheduler(); + // Called by a scheduler to indicate that it is terminating + void release_scheduler(); #ifdef __WIN32__ void win32_require(LPCTSTR fn, BOOL ok); |
