diff options
| author | Eric Holk <eholk@mozilla.com> | 2011-08-01 14:57:17 -0700 |
|---|---|---|
| committer | Eric Holk <eholk@mozilla.com> | 2011-08-01 15:58:39 -0700 |
| commit | 939bca0d84af1b52539d7b02a3be03bd64fcc17d (patch) | |
| tree | 86e2bc7184d92002ad9dcb7c214af595be21a559 /src/rt/rust_upcall.cpp | |
| parent | 6a6d5c669e363238abbed050f62658ee6e74cbbf (diff) | |
| download | rust-939bca0d84af1b52539d7b02a3be03bd64fcc17d.tar.gz rust-939bca0d84af1b52539d7b02a3be03bd64fcc17d.zip | |
Added send and receive to comm library.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
| -rw-r--r-- | src/rt/rust_upcall.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index c8d71165a8a..4946a516479 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -194,29 +194,11 @@ upcall_send(rust_task *task, rust_chan *chan, void *sptr) { } extern "C" CDECL void +port_recv(rust_task *task, uintptr_t *dptr, rust_port *port); +extern "C" CDECL void upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) { LOG_UPCALL_ENTRY(task); - { - scoped_lock with(port->lock); - - LOG(task, comm, "port: 0x%" PRIxPTR ", dptr: 0x%" PRIxPTR - ", size: 0x%" PRIxPTR ", chan_no: %d", - (uintptr_t) port, (uintptr_t) dptr, port->unit_sz, - port->chans.length()); - - if (port->receive(dptr)) { - return; - } - - // No data was buffered on any incoming channel, so block this task on - // the port. Remember the rendezvous location so that any sender task - // can write to it before waking up this task. - - LOG(task, comm, "<=== waiting for rendezvous data ==="); - task->rendezvous_ptr = dptr; - task->block(port, "waiting for rendezvous data"); - } - task->yield(3); + port_recv(task, dptr, port); } extern "C" CDECL void |
