3 * Copyright (c) 1997-2002, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
10 typedef int perl_mutex;
13 typedef struct perl_thread *perl_os_thread;
14 /* With fake threads, thr is global(ish) so we don't need dTHR */
15 #define dTHR extern int errno
17 struct perl_wait_queue {
18 struct perl_thread * thread;
19 struct perl_wait_queue * next;
21 typedef struct perl_wait_queue *perl_cond;
23 /* Ask thread.h to include our per-thread extras */
24 #define HAVE_THREAD_INTERN
25 struct thread_intern {
26 perl_os_thread next_run, prev_run; /* Linked list of runnable threads */
27 perl_cond wait_queue; /* Wait queue that we are waiting on */
28 IV private; /* Holds data across time slices */
29 I32 savemark; /* Holds MARK for thread join values */
32 #define init_thread_intern(t) \
35 (t)->i.next_run = (t)->i.prev_run = (t); \
36 (t)->i.wait_queue = 0; \
41 * Note that SCHEDULE() is only callable from pp code (which
42 * must be expecting to be restarted). We'll have to do
43 * something a bit different for XS code.
46 #define SCHEDULE() return schedule(), PL_op
49 #define MUTEX_UNLOCK(m)
51 #define MUTEX_DESTROY(m)
52 #define COND_INIT(c) perl_cond_init(c)
53 #define COND_SIGNAL(c) perl_cond_signal(c)
54 #define COND_BROADCAST(c) perl_cond_broadcast(c)
55 #define COND_WAIT(c, m) \
60 #define COND_DESTROY(c)
62 #define THREAD_CREATE(t, f) f((t))
63 #define THREAD_POST_CREATE(t) NOOP