diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-08-07 14:42:30 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-08-07 18:18:48 -0400 |
| commit | bdbad614ac7ea948fdd0d9cfb509d9b05008c3c2 (patch) | |
| tree | f9dbfb1ce10048c92d24b0f2d05b14750170c769 /src/rt/rust_builtin.cpp | |
| parent | 32e4fd62e968cba994aa4e4a85b00c072fe58bc1 (diff) | |
| download | rust-bdbad614ac7ea948fdd0d9cfb509d9b05008c3c2.tar.gz rust-bdbad614ac7ea948fdd0d9cfb509d9b05008c3c2.zip | |
Remove rust_cond_lock and sys::condition (rename to little_lock)
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 1ba941c233c..465eb6efe38 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -7,7 +7,6 @@ #include "sync/timer.h" #include "rust_abi.h" #include "rust_port.h" -#include "rust_cond_lock.h" #include <time.h> @@ -882,56 +881,24 @@ bool rust_task_is_unwinding(rust_task *rt) { return rt->unwinding; } -extern "C" rust_cond_lock* -rust_create_cond_lock() { - return new rust_cond_lock(); +extern "C" lock_and_signal* +rust_create_little_lock() { + return new lock_and_signal(); } extern "C" void -rust_destroy_cond_lock(rust_cond_lock *lock) { +rust_destroy_little_lock(lock_and_signal *lock) { delete lock; } extern "C" void -rust_lock_cond_lock(rust_cond_lock *lock) { - lock->lock.lock(); +rust_lock_little_lock(lock_and_signal *lock) { + lock->lock(); } extern "C" void -rust_unlock_cond_lock(rust_cond_lock *lock) { - lock->lock.unlock(); -} - -// The next two functions do not use the built in condition variable features -// because the Rust schedule is not aware of them, and they can block the -// scheduler thread. - -extern "C" void -rust_wait_cond_lock(rust_cond_lock *lock) { - assert(false && "condition->wait() is totally broken! Don't use it!"); - rust_task *task = rust_get_current_task(); - lock->lock.must_have_lock(); - assert(NULL == lock->waiting); - lock->waiting = task; - task->block(lock, "waiting for signal"); - lock->lock.unlock(); - bool killed = task->yield(); - assert(!killed && "unimplemented"); - lock->lock.lock(); -} - -extern "C" bool -rust_signal_cond_lock(rust_cond_lock *lock) { - assert(false && "condition->signal() is totally broken! Don't use it!"); - lock->lock.must_have_lock(); - if(NULL == lock->waiting) { - return false; - } - else { - lock->waiting->wakeup(lock); - lock->waiting = NULL; - return true; - } +rust_unlock_little_lock(lock_and_signal *lock) { + lock->unlock(); } // set/get/atexit task_local_data can run on the rust stack for speed. |
