source: trunk/third/perl/fakethr.h @ 14545

Revision 14545, 1.6 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14544, which included commits to RCS files with non-trunk default branches.
Line 
1typedef int perl_mutex;
2typedef int perl_key;
3
4typedef struct perl_thread *perl_os_thread;
5/* With fake threads, thr is global(ish) so we don't need dTHR */
6#define dTHR extern int errno
7
8struct perl_wait_queue {
9    struct perl_thread *        thread;
10    struct perl_wait_queue *    next;
11};
12typedef struct perl_wait_queue *perl_cond;
13
14/* Ask thread.h to include our per-thread extras */
15#define HAVE_THREAD_INTERN
16struct thread_intern {
17    perl_os_thread next_run, prev_run;  /* Linked list of runnable threads */
18    perl_cond   wait_queue;             /* Wait queue that we are waiting on */
19    IV          private;                /* Holds data across time slices */
20    I32         savemark;               /* Holds MARK for thread join values */
21};
22
23#define init_thread_intern(t)                           \
24    STMT_START {                                        \
25        t->self = (t);                                  \
26        (t)->i.next_run = (t)->i.prev_run = (t);        \
27        (t)->i.wait_queue = 0;                          \
28        (t)->i.private = 0;                             \
29    } STMT_END
30
31/*
32 * Note that SCHEDULE() is only callable from pp code (which
33 * must be expecting to be restarted). We'll have to do
34 * something a bit different for XS code.
35 */
36
37#define SCHEDULE() return schedule(), PL_op
38
39#define MUTEX_LOCK(m)
40#define MUTEX_UNLOCK(m)
41#define MUTEX_INIT(m)
42#define MUTEX_DESTROY(m)
43#define COND_INIT(c) perl_cond_init(c)
44#define COND_SIGNAL(c) perl_cond_signal(c)
45#define COND_BROADCAST(c) perl_cond_broadcast(c)
46#define COND_WAIT(c, m)         \
47    STMT_START {                \
48        perl_cond_wait(c);      \
49        SCHEDULE();             \
50    } STMT_END
51#define COND_DESTROY(c)
52
53#define THREAD_CREATE(t, f)     f((t))
54#define THREAD_POST_CREATE(t)   NOOP
55
56#define YIELD   NOOP
Note: See TracBrowser for help on using the repository browser.