diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-07 22:24:56 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-08 15:42:51 -0800 |
| commit | 149d1d4a6e3bb8a439eff78cc6edb25f16aa47c5 (patch) | |
| tree | 8cf83c0d9cc29e4d7a71aadcb7d209aef6d23179 /src/rt/rust_builtin.cpp | |
| parent | 35ba9715fafe14c96081049327c808fd0c5a2792 (diff) | |
| download | rust-149d1d4a6e3bb8a439eff78cc6edb25f16aa47c5.tar.gz rust-149d1d4a6e3bb8a439eff78cc6edb25f16aa47c5.zip | |
core: Add a test for blocking in native code
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index c228aa9159f..19295167518 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -626,6 +626,46 @@ rust_log_console_off() { log_console_off(task->kernel->env); } +extern "C" CDECL lock_and_signal * +rust_dbg_lock_create() { + return new lock_and_signal(); +} + +extern "C" CDECL void +rust_dbg_lock_destroy(lock_and_signal *lock) { + rust_task *task = rust_task_thread::get_task(); + I(task->thread, lock); + delete lock; +} + +extern "C" CDECL void +rust_dbg_lock_lock(lock_and_signal *lock) { + rust_task *task = rust_task_thread::get_task(); + I(task->thread, lock); + lock->lock(); +} + +extern "C" CDECL void +rust_dbg_lock_unlock(lock_and_signal *lock) { + rust_task *task = rust_task_thread::get_task(); + I(task->thread, lock); + lock->unlock(); +} + +extern "C" CDECL void +rust_dbg_lock_wait(lock_and_signal *lock) { + rust_task *task = rust_task_thread::get_task(); + I(task->thread, lock); + lock->wait(); +} + +extern "C" CDECL void +rust_dbg_lock_signal(lock_and_signal *lock) { + rust_task *task = rust_task_thread::get_task(); + I(task->thread, lock); + lock->signal(); +} + // // Local Variables: // mode: C++ |
