Skip to content

Commit

Permalink
Update future.c
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Aug 4, 2024
1 parent ce75fdf commit 1f94b57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/future.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void co_async_wait(future *f) {
bool is_done = false;
while (!is_done) {
is_done = promise_done(f->value);
co_info(co_active());
co_yield();
}
}
Expand Down Expand Up @@ -122,12 +123,12 @@ promise *promise_create(void) {
}

void promise_set(promise *p, int res) {
RAII_INFO("promise id(%d) set LOCK in thread #%lx\n", p->id, co_async_self());
RAII_INFO("promise id(%d) set LOCK in thread #%lx \n", p->id, co_async_self());
mtx_lock(&p->mutex);
p->result->value.integer = res;
p->done = true;
cnd_signal(&p->cond);
RAII_INFO("promise id(%d) set UNLOCK in thread #%lx\n", p->id, co_async_self());
RAII_INFO("promise id(%d) set UNLOCK in thread #%lx \n", p->id, co_async_self());
mtx_unlock(&p->mutex);
}

Expand Down

0 comments on commit 1f94b57

Please sign in to comment.