2002-01-15 00:41:22 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
cothreads
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
|
|
|
userspace threads
|
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
|
|
|
Cothreads are a simple user-space method for switching between
|
|
|
|
subtasks. They're based on setjmp()/longjmp() in their current form.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Cothreads are used for loop-based elements that pull data instead
|
2002-12-14 16:22:01 +00:00
|
|
|
of being fed with data. Cothreads are usually used by a #GstScheduler.
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
2002-12-14 16:22:01 +00:00
|
|
|
#GstScheduler
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### STRUCT cothread_state ##### -->
|
|
|
|
<para>
|
2002-12-14 13:02:16 +00:00
|
|
|
The cothread state structure
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
@ctx:
|
2002-12-08 14:39:38 +00:00
|
|
|
@cothreadnum:
|
2002-03-31 14:00:33 +00:00
|
|
|
@priv:
|
2002-01-15 00:41:22 +00:00
|
|
|
@func:
|
|
|
|
@argc:
|
|
|
|
@argv:
|
|
|
|
@flags:
|
|
|
|
@sp:
|
|
|
|
@jmp:
|
2002-12-08 14:39:38 +00:00
|
|
|
@stack_base:
|
|
|
|
@stack_size:
|
2002-07-11 19:40:06 +00:00
|
|
|
@magic_number:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
<!-- ##### STRUCT cothread_context ##### -->
|
|
|
|
<para>
|
2002-12-14 13:02:16 +00:00
|
|
|
The cothread context structure
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### USER_FUNCTION cothread_func ##### -->
|
|
|
|
<para>
|
|
|
|
the function that will be called when the cothread starts. The function
|
|
|
|
prototype is like a main() function, so you can do whatever you want with
|
|
|
|
it.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@argc: a main-like argument count
|
|
|
|
@argv: a main-like array of arguments
|
|
|
|
@Returns: a return code
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO COTHREAD_STARTED ##### -->
|
|
|
|
<para>
|
|
|
|
Indicates the cothread is started.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO COTHREAD_DESTROYED ##### -->
|
|
|
|
<para>
|
|
|
|
Indicates the cothread is destroyed.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_context_init ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_context_free ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@ctx:
|
|
|
|
|
|
|
|
|
2002-03-31 14:00:33 +00:00
|
|
|
<!-- ##### FUNCTION cothread_get_private ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-03-31 14:00:33 +00:00
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_set_private ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-03-31 14:00:33 +00:00
|
|
|
@data:
|
|
|
|
|
|
|
|
|
2002-01-15 00:41:22 +00:00
|
|
|
<!-- ##### FUNCTION cothread_create ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@ctx:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_free ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_setfunc ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
@func:
|
|
|
|
@argc:
|
|
|
|
@argv:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_stop ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_switch ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
2002-03-31 14:00:33 +00:00
|
|
|
<!-- ##### FUNCTION cothread_context_get_data ##### -->
|
2002-01-15 00:41:22 +00:00
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
@key:
|
2002-03-31 14:00:33 +00:00
|
|
|
@Returns:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
2002-03-31 14:00:33 +00:00
|
|
|
<!-- ##### FUNCTION cothread_context_set_data ##### -->
|
2002-01-15 00:41:22 +00:00
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
@key:
|
2002-03-31 14:00:33 +00:00
|
|
|
@data:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_lock ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_trylock ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_unlock ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2002-12-14 16:22:01 +00:00
|
|
|
@cothread:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_main ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@ctx:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_current_main ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION cothread_current ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|