Rename runtime *_locked() and *_unlocked() fns to *_inner() (closes #2864)

This commit is contained in:
Ben Blum 2012-07-11 15:34:40 -04:00
parent 9d2e5f3a65
commit b897696a3a
2 changed files with 19 additions and 19 deletions

View File

@ -231,11 +231,11 @@ void rust_task::start()
bool bool
rust_task::must_fail_from_being_killed() { rust_task::must_fail_from_being_killed() {
scoped_lock with(lifecycle_lock); scoped_lock with(lifecycle_lock);
return must_fail_from_being_killed_unlocked(); return must_fail_from_being_killed_inner();
} }
bool bool
rust_task::must_fail_from_being_killed_unlocked() { rust_task::must_fail_from_being_killed_inner() {
lifecycle_lock.must_have_lock(); lifecycle_lock.must_have_lock();
return killed && !reentered_rust_stack && disallow_kill == 0; return killed && !reentered_rust_stack && disallow_kill == 0;
} }
@ -275,8 +275,8 @@ rust_task::kill() {
// Unblock the task so it can unwind. // Unblock the task so it can unwind.
if (state == task_state_blocked && if (state == task_state_blocked &&
must_fail_from_being_killed_unlocked()) { must_fail_from_being_killed_inner()) {
wakeup_locked(cond); wakeup_inner(cond);
} }
LOG(this, task, "preparing to unwind task: 0x%" PRIxPTR, this); LOG(this, task, "preparing to unwind task: 0x%" PRIxPTR, this);
@ -377,10 +377,10 @@ void
rust_task::transition(rust_task_state src, rust_task_state dst, rust_task::transition(rust_task_state src, rust_task_state dst,
rust_cond *cond, const char* cond_name) { rust_cond *cond, const char* cond_name) {
scoped_lock with(lifecycle_lock); scoped_lock with(lifecycle_lock);
transition_locked(src, dst, cond, cond_name); transition_inner(src, dst, cond, cond_name);
} }
void rust_task::transition_locked(rust_task_state src, rust_task_state dst, void rust_task::transition_inner(rust_task_state src, rust_task_state dst,
rust_cond *cond, const char* cond_name) { rust_cond *cond, const char* cond_name) {
lifecycle_lock.must_have_lock(); lifecycle_lock.must_have_lock();
sched_loop->transition(this, src, dst, cond, cond_name); sched_loop->transition(this, src, dst, cond, cond_name);
@ -398,12 +398,12 @@ rust_task::set_state(rust_task_state state,
bool bool
rust_task::block(rust_cond *on, const char* name) { rust_task::block(rust_cond *on, const char* name) {
scoped_lock with(lifecycle_lock); scoped_lock with(lifecycle_lock);
return block_locked(on, name); return block_inner(on, name);
} }
bool bool
rust_task::block_locked(rust_cond *on, const char* name) { rust_task::block_inner(rust_cond *on, const char* name) {
if (must_fail_from_being_killed_unlocked()) { if (must_fail_from_being_killed_inner()) {
// We're already going to die. Don't block. Tell the task to fail // We're already going to die. Don't block. Tell the task to fail
return false; return false;
} }
@ -413,7 +413,7 @@ rust_task::block_locked(rust_cond *on, const char* name) {
assert(cond == NULL && "Cannot block an already blocked task."); assert(cond == NULL && "Cannot block an already blocked task.");
assert(on != NULL && "Cannot block on a NULL object."); assert(on != NULL && "Cannot block on a NULL object.");
transition_locked(task_state_running, task_state_blocked, on, name); transition_inner(task_state_running, task_state_blocked, on, name);
return true; return true;
} }
@ -421,17 +421,17 @@ rust_task::block_locked(rust_cond *on, const char* name) {
void void
rust_task::wakeup(rust_cond *from) { rust_task::wakeup(rust_cond *from) {
scoped_lock with(lifecycle_lock); scoped_lock with(lifecycle_lock);
wakeup_locked(from); wakeup_inner(from);
} }
void void
rust_task::wakeup_locked(rust_cond *from) { rust_task::wakeup_inner(rust_cond *from) {
assert(cond != NULL && "Cannot wake up unblocked task."); assert(cond != NULL && "Cannot wake up unblocked task.");
LOG(this, task, "Blocked on 0x%" PRIxPTR " woken up on 0x%" PRIxPTR, LOG(this, task, "Blocked on 0x%" PRIxPTR " woken up on 0x%" PRIxPTR,
(uintptr_t) cond, (uintptr_t) from); (uintptr_t) cond, (uintptr_t) from);
assert(cond == from && "Cannot wake up blocked task on wrong condition."); assert(cond == from && "Cannot wake up blocked task on wrong condition.");
transition_locked(task_state_blocked, task_state_running, NULL, "none"); transition_inner(task_state_blocked, task_state_running, NULL, "none");
} }
void void
@ -685,7 +685,7 @@ rust_task::wait_event(bool *killed) {
scoped_lock with(lifecycle_lock); scoped_lock with(lifecycle_lock);
if(!event_reject) { if(!event_reject) {
block_locked(&event_cond, "waiting on event"); block_inner(&event_cond, "waiting on event");
lifecycle_lock.unlock(); lifecycle_lock.unlock();
yield(killed); yield(killed);
lifecycle_lock.lock(); lifecycle_lock.lock();
@ -702,7 +702,7 @@ rust_task::signal_event(void *event) {
this->event = event; this->event = event;
event_reject = true; event_reject = true;
if(task_state_blocked == state) { if(task_state_blocked == state) {
wakeup_locked(&event_cond); wakeup_inner(&event_cond);
} }
} }

View File

@ -208,10 +208,10 @@ private:
void transition(rust_task_state src, rust_task_state dst, void transition(rust_task_state src, rust_task_state dst,
rust_cond *cond, const char* cond_name); rust_cond *cond, const char* cond_name);
void transition_locked(rust_task_state src, rust_task_state dst, void transition_inner(rust_task_state src, rust_task_state dst,
rust_cond *cond, const char* cond_name); rust_cond *cond, const char* cond_name);
bool must_fail_from_being_killed_unlocked(); bool must_fail_from_being_killed_inner();
// Called by rust_task_fail to unwind on failure // Called by rust_task_fail to unwind on failure
void begin_failure(char const *expr, void begin_failure(char const *expr,
char const *file, char const *file,
@ -226,8 +226,8 @@ private:
char const *file, char const *file,
size_t line); size_t line);
bool block_locked(rust_cond *on, const char* name); bool block_inner(rust_cond *on, const char* name);
void wakeup_locked(rust_cond *from); void wakeup_inner(rust_cond *from);
public: public: