mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
Adde cothread context cleanup code
Original commit message from CVS: Adde cothread context cleanup code
This commit is contained in:
parent
7cfd7c6d09
commit
e279738a3f
2 changed files with 21 additions and 0 deletions
|
@ -106,6 +106,26 @@ cothread_init (void)
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cothread_free (cothread_context *ctx)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i=0; i<ctx->nthreads; i++) {
|
||||||
|
#ifndef COTHREAD_ATOMIC
|
||||||
|
if (ctx->threads[i]->lock) {
|
||||||
|
g_mutex_unlock(ctx->threads[i]->lock);
|
||||||
|
g_mutex_free (ctx->threads[i]->lock);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (i == 0)
|
||||||
|
g_free (ctx->threads[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_destroy (ctx->data);
|
||||||
|
g_free (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cothread_create:
|
* cothread_create:
|
||||||
* @ctx: the cothread context
|
* @ctx: the cothread context
|
||||||
|
|
|
@ -68,6 +68,7 @@ struct _cothread_state {
|
||||||
|
|
||||||
cothread_context* cothread_init (void);
|
cothread_context* cothread_init (void);
|
||||||
cothread_state* cothread_create (cothread_context *ctx);
|
cothread_state* cothread_create (cothread_context *ctx);
|
||||||
|
void cothread_free (cothread_context *ctx);
|
||||||
void cothread_setfunc (cothread_state *thread, cothread_func func,
|
void cothread_setfunc (cothread_state *thread, cothread_func func,
|
||||||
int argc, char **argv);
|
int argc, char **argv);
|
||||||
int cothread_getcurrent (void);
|
int cothread_getcurrent (void);
|
||||||
|
|
Loading…
Reference in a new issue