Revert "Adding a lock/condition variable to libcore."

This reverts commit e394ebda37.
This commit is contained in:
Tim Chevalier
2012-06-16 15:34:15 -07:00
parent e3c6e5e5b6
commit 3e2006a570
6 changed files with 0 additions and 155 deletions

View File

@@ -7,7 +7,6 @@
#include "sync/timer.h"
#include "rust_abi.h"
#include "rust_port.h"
#include "rust_cond_lock.h"
#include <time.h>
@@ -863,60 +862,6 @@ rust_task_allow_kill() {
task->allow_kill();
}
extern "C" rust_cond_lock*
rust_create_cond_lock() {
return new rust_cond_lock();
}
extern "C" void
rust_destroy_cond_lock(rust_cond_lock *lock) {
delete lock;
}
extern "C" void
rust_lock_cond_lock(rust_cond_lock *lock) {
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) {
rust_task *task = rust_get_current_task();
#ifdef DEBUG_LOCKS
assert(lock->lock.lock_held_by_current_thread());
#endif
assert(NULL == lock->waiting);
lock->waiting = task;
lock->lock.unlock();
task->block(lock, "waiting for signal");
lock->lock.lock();
lock->waiting = NULL;
}
extern "C" bool
rust_signal_cond_lock(rust_cond_lock *lock) {
#ifdef DEBUG_LOCKS
assert(lock->lock.lock_held_by_current_thread());
#endif
if(NULL == lock->waiting) {
return false;
}
else {
lock->waiting->wakeup(lock);
return true;
}
}
//
// Local Variables:
// mode: C++