source: trunk/third/gstreamer/gst/cothreads.h @ 21005

Revision 21005, 2.4 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21004, which included commits to RCS files with non-trunk default branches.
Line 
1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 *                    2000 Wim Taymans <wtay@chello.be>
4 *
5 * cothreads.h: Header for cothreading routines
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23#ifndef __COTHREADS_H__
24#define __COTHREADS_H__
25
26#include <glib.h>
27#include <setjmp.h>
28
29typedef struct _cothread_state          cothread_state;
30typedef struct _cothread_context        cothread_context;
31
32typedef int (*cothread_func) (int argc,char **argv);
33
34#define COTHREAD_STARTED        0x01
35#define COTHREAD_DESTROYED      0x02
36
37struct _cothread_state {
38  cothread_context      *ctx;
39  int                    cothreadnum;
40  gpointer               priv;
41
42  cothread_func          func;
43  int                    argc;
44  char                 **argv;
45
46  int                    flags;
47  void                  *sp;
48  jmp_buf                jmp;
49  void                  *stack_base;
50  unsigned long          stack_size;
51
52  int                    magic_number;
53};
54
55
56cothread_context*               cothread_context_init           (void);
57void                            cothread_context_free           (cothread_context *ctx);
58void                            cothread_context_set_data       (cothread_state *cothread,
59                                                                 gchar *key, gpointer data);
60gpointer                        cothread_context_get_data       (cothread_state *cothread, gchar *key);
61
62cothread_state*                 cothread_create                 (cothread_context *ctx);
63void                            cothread_free                   (cothread_state *cothread);
64void                            cothread_setfunc                (cothread_state *cothread, cothread_func func,
65                                                                 int argc, char **argv);
66void                            cothread_stop                   (cothread_state *cothread);
67
68void                            cothread_switch                 (cothread_state *cothread);
69void                            cothread_set_private            (cothread_state *cothread,
70                                                                 gpointer data);
71gpointer                        cothread_get_private            (cothread_state *cothread);
72
73cothread_state*                 cothread_main                   (cothread_context *ctx);
74cothread_state*                 cothread_current_main           (void);
75cothread_state*                 cothread_current                (void);
76
77#endif /* __COTHREAD_H__ */
Note: See TracBrowser for help on using the repository browser.