about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-06-24 16:50:06 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-06-28 16:12:33 -0700
commitf6f945fed5c8d1061d80b444331910df29afa392 (patch)
tree1ee8908830878e916d26cbae145b00771d5c9c9d /src/rt/rust_upcall.cpp
parentc6d83248301b4aed366b9bef682d200381324c01 (diff)
downloadrust-f6f945fed5c8d1061d80b444331910df29afa392.tar.gz
rust-f6f945fed5c8d1061d80b444331910df29afa392.zip
Moved thread management to rust_kernel.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index a769051b7eb..ccb35958a80 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -75,7 +75,7 @@ extern "C" CDECL rust_port*
 upcall_new_port(rust_task *task, size_t unit_sz) {
     LOG_UPCALL_ENTRY(task);
     rust_dom *dom = task->dom;
-    scoped_lock with(dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     LOG(task, comm, "upcall_new_port(task=0x%" PRIxPTR " (%s), unit_sz=%d)",
         (uintptr_t) task, task->name, unit_sz);
     return new (dom) rust_port(task, unit_sz);
@@ -84,7 +84,7 @@ upcall_new_port(rust_task *task, size_t unit_sz) {
 extern "C" CDECL void
 upcall_del_port(rust_task *task, rust_port *port) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     LOG(task, comm, "upcall del_port(0x%" PRIxPTR ")", (uintptr_t) port);
     I(task->dom, !port->ref_count);
     delete port;
@@ -124,7 +124,7 @@ upcall_flush_chan(rust_task *task, rust_chan *chan) {
 extern "C" CDECL
 void upcall_del_chan(rust_task *task, rust_chan *chan) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
 
     LOG(task, comm, "upcall del_chan(0x%" PRIxPTR ")", (uintptr_t) chan);
 
@@ -166,7 +166,7 @@ extern "C" CDECL rust_chan *
 upcall_clone_chan(rust_task *task, maybe_proxy<rust_task> *target,
                   rust_chan *chan) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     size_t unit_sz = chan->buffer.unit_sz;
     maybe_proxy<rust_port> *port = chan->port;
     rust_task *target_task = NULL;
@@ -208,7 +208,7 @@ upcall_sleep(rust_task *task, size_t time_in_us) {
 extern "C" CDECL void
 upcall_send(rust_task *task, rust_chan *chan, void *sptr) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     chan->send(sptr);
     LOG(task, comm, "=== sent data ===>");
 }
@@ -217,7 +217,7 @@ extern "C" CDECL void
 upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) {
     {
         LOG_UPCALL_ENTRY(task);
-        scoped_lock with(task->dom->scheduler_lock);
+        scoped_lock with(task->kernel->scheduler_lock);
 
         LOG(task, comm, "port: 0x%" PRIxPTR ", dptr: 0x%" PRIxPTR
             ", size: 0x%" PRIxPTR ", chan_no: %d",
@@ -255,7 +255,7 @@ upcall_fail(rust_task *task,
 extern "C" CDECL void
 upcall_kill(rust_task *task, maybe_proxy<rust_task> *target) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     if (target->is_proxy()) {
         notify_message::
         send(notify_message::KILL, "kill", task->get_handle(),
@@ -274,7 +274,7 @@ extern "C" CDECL void
 upcall_exit(rust_task *task) {
     {
         LOG_UPCALL_ENTRY(task);
-        scoped_lock with(task->dom->scheduler_lock);
+        scoped_lock with(task->kernel->scheduler_lock);
         LOG(task, task, "task ref_count: %d", task->ref_count);
         A(task->dom, task->ref_count >= 0,
           "Task ref_count should not be negative on exit!");
@@ -287,7 +287,7 @@ upcall_exit(rust_task *task) {
 extern "C" CDECL uintptr_t
 upcall_malloc(rust_task *task, size_t nbytes, type_desc *td) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
 
     LOG(task, mem,
                    "upcall malloc(%" PRIdPTR ", 0x%" PRIxPTR ")"
@@ -308,7 +308,7 @@ upcall_malloc(rust_task *task, size_t nbytes, type_desc *td) {
 extern "C" CDECL void
 upcall_free(rust_task *task, void* ptr, uintptr_t is_gc) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     rust_dom *dom = task->dom;
     DLOG(dom, mem,
              "upcall free(0x%" PRIxPTR ", is_gc=%" PRIdPTR ")",
@@ -319,7 +319,7 @@ upcall_free(rust_task *task, void* ptr, uintptr_t is_gc) {
 extern "C" CDECL uintptr_t
 upcall_mark(rust_task *task, void* ptr) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
 
     rust_dom *dom = task->dom;
     if (ptr) {
@@ -350,7 +350,7 @@ rust_str *make_str(rust_task *task, char const *s, size_t fill) {
 extern "C" CDECL rust_str *
 upcall_new_str(rust_task *task, char const *s, size_t fill) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     
     return make_str(task, s, fill);
 }
@@ -358,7 +358,7 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) {
 extern "C" CDECL rust_str *
 upcall_dup_str(rust_task *task, rust_str *str) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
 
     return make_str(task, (char const *)str->data, str->fill);
 }
@@ -366,7 +366,7 @@ upcall_dup_str(rust_task *task, rust_str *str) {
 extern "C" CDECL rust_vec *
 upcall_new_vec(rust_task *task, size_t fill, type_desc *td) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     rust_dom *dom = task->dom;
     DLOG(dom, mem, "upcall new_vec(%" PRIdPTR ")", fill);
     size_t alloc = next_power_of_two(sizeof(rust_vec) + fill);
@@ -471,7 +471,7 @@ upcall_vec_append(rust_task *task, type_desc *t, type_desc *elem_t,
                   rust_vec **dst_ptr, rust_vec *src, bool skip_null)
 {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     rust_vec *dst = *dst_ptr;
     uintptr_t need_copy;
     size_t n_src_bytes = skip_null ? src->fill - 1 : src->fill;
@@ -507,7 +507,7 @@ upcall_get_type_desc(rust_task *task,
                      size_t n_descs,
                      type_desc const **descs) {
     LOG_UPCALL_ENTRY(task);
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     LOG(task, cache, "upcall get_type_desc with size=%" PRIdPTR
         ", align=%" PRIdPTR ", %" PRIdPTR " descs", size, align,
         n_descs);
@@ -521,7 +521,7 @@ extern "C" CDECL rust_task *
 upcall_new_task(rust_task *spawner, rust_vec *name) {
     // name is a rust string structure.
     LOG_UPCALL_ENTRY(spawner);
-    scoped_lock with(spawner->dom->scheduler_lock);
+    scoped_lock with(spawner->kernel->scheduler_lock);
     rust_dom *dom = spawner->dom;
     rust_task *task = dom->create_task(spawner, (const char *)name->data);
     return task;
@@ -563,7 +563,7 @@ extern "C" CDECL void
 upcall_ivec_resize(rust_task *task,
                    rust_ivec *v,
                    size_t newsz) {
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     I(task->dom, !v->fill);
 
     size_t new_alloc = next_power_of_two(newsz);
@@ -582,7 +582,7 @@ extern "C" CDECL void
 upcall_ivec_spill(rust_task *task,
                   rust_ivec *v,
                   size_t newsz) {
-    scoped_lock with(task->dom->scheduler_lock);
+    scoped_lock with(task->kernel->scheduler_lock);
     size_t new_alloc = next_power_of_two(newsz);
 
     rust_ivec_heap *heap_part = (rust_ivec_heap *)