Skip to content
Snippets Groups Projects
Commit f74f7cc9 authored by Thierno souleymane Bah's avatar Thierno souleymane Bah
Browse files

feat(switch_to_ctx function updated to take into account semanphore, CTX_WAIT status used)

parent af74472c
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,8 @@ int init_ctx(ctx_t *pctx, funct_t f, void *args)
}
void switch_to_ctx(ctx_t *pctx)
{
if (pctx->status == CTX_END || pctx->status == CTX_WAIT)
{
if (pctx->status == CTX_END)
{
......@@ -51,11 +53,12 @@ void switch_to_ctx(ctx_t *pctx)
current_ctx->next_ctx = pctx->next_ctx;
free_ctx(pctx);
}
yield();
return;
}
assert(pctx->status != CTX_END);
assert(pctx->status != CTX_END && pctx->status != CTX_WAIT);
if (current_ctx != NULL)
{
// Sauvegarder où on en est avec le ctx courant
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment