rt: Renome rust_task::lock to port_lock
This commit is contained in:
@@ -489,7 +489,7 @@ rust_port_detach(rust_port *port) {
|
|||||||
// FIXME: Busy waiting until we're the only ref
|
// FIXME: Busy waiting until we're the only ref
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
scoped_lock with(task->lock);
|
scoped_lock with(task->port_lock);
|
||||||
done = port->ref_count == 1;
|
done = port->ref_count == 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,7 +528,7 @@ chan_id_send(type_desc *t, rust_task_id target_task_id,
|
|||||||
rust_port *port = target_task->get_port_by_id(target_port_id);
|
rust_port *port = target_task->get_port_by_id(target_port_id);
|
||||||
if(port) {
|
if(port) {
|
||||||
port->send(sptr);
|
port->send(sptr);
|
||||||
scoped_lock with(target_task->lock);
|
scoped_lock with(target_task->port_lock);
|
||||||
port->deref();
|
port->deref();
|
||||||
sent = true;
|
sent = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ rust_port::~rust_port() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rust_port::detach() {
|
void rust_port::detach() {
|
||||||
I(task->thread, !task->lock.lock_held_by_current_thread());
|
I(task->thread, !task->port_lock.lock_held_by_current_thread());
|
||||||
scoped_lock with(task->lock);
|
scoped_lock with(task->port_lock);
|
||||||
{
|
{
|
||||||
task->release_port(id);
|
task->release_port(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void
|
|||||||
rust_port_selector::msg_sent_on(rust_port *port) {
|
rust_port_selector::msg_sent_on(rust_port *port) {
|
||||||
rust_task *task = port->task;
|
rust_task *task = port->task;
|
||||||
|
|
||||||
I(task->thread, !task->lock.lock_held_by_current_thread());
|
I(task->thread, !task->port_lock.lock_held_by_current_thread());
|
||||||
I(task->thread, !port->lock.lock_held_by_current_thread());
|
I(task->thread, !port->lock.lock_held_by_current_thread());
|
||||||
I(task->thread, !rendezvous_lock.lock_held_by_current_thread());
|
I(task->thread, !rendezvous_lock.lock_held_by_current_thread());
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void
|
|||||||
rust_task::delete_this()
|
rust_task::delete_this()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
scoped_lock with (lock);
|
scoped_lock with (port_lock);
|
||||||
I(thread, port_table.is_empty());
|
I(thread, port_table.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,8 +471,8 @@ rust_task::calloc(size_t size, const char *tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rust_port_id rust_task::register_port(rust_port *port) {
|
rust_port_id rust_task::register_port(rust_port *port) {
|
||||||
I(thread, !lock.lock_held_by_current_thread());
|
I(thread, !port_lock.lock_held_by_current_thread());
|
||||||
scoped_lock with(lock);
|
scoped_lock with(port_lock);
|
||||||
|
|
||||||
rust_port_id id = next_port_id++;
|
rust_port_id id = next_port_id++;
|
||||||
A(thread, id != INTPTR_MAX, "Hit the maximum port id");
|
A(thread, id != INTPTR_MAX, "Hit the maximum port id");
|
||||||
@@ -481,13 +481,13 @@ rust_port_id rust_task::register_port(rust_port *port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rust_task::release_port(rust_port_id id) {
|
void rust_task::release_port(rust_port_id id) {
|
||||||
I(thread, lock.lock_held_by_current_thread());
|
I(thread, port_lock.lock_held_by_current_thread());
|
||||||
port_table.remove(id);
|
port_table.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
rust_port *rust_task::get_port_by_id(rust_port_id id) {
|
rust_port *rust_task::get_port_by_id(rust_port_id id) {
|
||||||
I(thread, !lock.lock_held_by_current_thread());
|
I(thread, !port_lock.lock_held_by_current_thread());
|
||||||
scoped_lock with(lock);
|
scoped_lock with(port_lock);
|
||||||
rust_port *port = NULL;
|
rust_port *port = NULL;
|
||||||
port_table.get(id, &port);
|
port_table.get(id, &port);
|
||||||
if (port) {
|
if (port) {
|
||||||
@@ -510,7 +510,7 @@ rust_task::notify(bool success) {
|
|||||||
msg.result = !success ? tr_failure : tr_success;
|
msg.result = !success ? tr_failure : tr_success;
|
||||||
|
|
||||||
target_port->send(&msg);
|
target_port->send(&msg);
|
||||||
scoped_lock with(target_task->lock);
|
scoped_lock with(target_task->port_lock);
|
||||||
target_port->deref();
|
target_port->deref();
|
||||||
}
|
}
|
||||||
target_task->deref();
|
target_task->deref();
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ rust_task : public kernel_owned<rust_task>, rust_cond
|
|||||||
|
|
||||||
bool propagate_failure;
|
bool propagate_failure;
|
||||||
|
|
||||||
lock_and_signal lock;
|
// Protects port_table
|
||||||
|
lock_and_signal port_lock;
|
||||||
hash_map<rust_port_id, rust_port *> port_table;
|
hash_map<rust_port_id, rust_port *> port_table;
|
||||||
|
|
||||||
rust_obstack dynastack;
|
rust_obstack dynastack;
|
||||||
|
|||||||
Reference in New Issue
Block a user