Skip to content

Commit

Permalink
Cache task handles.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbebenita committed Sep 9, 2010
1 parent 616b7af commit 743ca28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rt/rust_task.cpp
Expand Up @@ -69,7 +69,8 @@ rust_task::rust_task(rust_dom *dom, rust_task *spawner, const char *name) :
supervisor(spawner),
idx(0),
rendezvous_ptr(0),
alarm(this)
alarm(this),
handle(NULL)
{
dom->logptr("new task", (uintptr_t)this);

Expand Down Expand Up @@ -633,7 +634,10 @@ rust_task::log(uint32_t type_bits, char const *fmt, ...) {

rust_handle<rust_task> *
rust_task::get_handle() {
return dom->kernel->get_task_handle(this);
if (handle == NULL) {
handle = dom->kernel->get_task_handle(this);
}
return handle;
}

//
Expand Down
2 changes: 2 additions & 0 deletions src/rt/rust_task.h
Expand Up @@ -46,6 +46,8 @@ rust_task : public maybe_proxy<rust_task>,

rust_alarm alarm;

rust_handle<rust_task> *handle;

// Only a pointer to 'name' is kept, so it must live as long as this task.
rust_task(rust_dom *dom,
rust_task *spawner,
Expand Down

0 comments on commit 743ca28

Please sign in to comment.