summaryrefslogtreecommitdiff
path: root/fakethr.h
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-24 13:50:59 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-24 13:50:59 +0000
commitea0efc06fdad2019ffceb86d079dd853e9d79cea (patch)
tree7fedea92fa5ecf04cfd8d38fc6a0d997d14ac2d6 /fakethr.h
parent4f01c5a5705fca4c6743c9938e82ea378a5b35e8 (diff)
downloadperl-ea0efc06fdad2019ffceb86d079dd853e9d79cea.tar.gz
Improve internal threading API. Introduce win32/win32thread.[ch]
to use new API and patch win32 makefile stuff a little. p4raw-id: //depot/perl@172
Diffstat (limited to 'fakethr.h')
-rw-r--r--fakethr.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/fakethr.h b/fakethr.h
index dac2cc9030..eaab4b8ca7 100644
--- a/fakethr.h
+++ b/fakethr.h
@@ -1,6 +1,10 @@
typedef int perl_mutex;
typedef int perl_key;
+typedef struct thread *perl_thread;
+/* With fake threads, thr is global(ish) so we don't need dTHR */
+#define dTHR extern int errno
+
struct perl_wait_queue {
struct thread * thread;
struct perl_wait_queue * next;
@@ -24,3 +28,29 @@ struct thread_intern {
(t)->i.private = 0; \
} STMT_END
+/*
+ * Note that SCHEDULE() is only callable from pp code (which
+ * must be expecting to be restarted). We'll have to do
+ * something a bit different for XS code.
+ */
+
+#define SCHEDULE() return schedule(), op
+
+#define MUTEX_LOCK(m)
+#define MUTEX_UNLOCK(m)
+#define MUTEX_INIT(m)
+#define MUTEX_DESTROY(m)
+#define COND_INIT(c) perl_cond_init(c)
+#define COND_SIGNAL(c) perl_cond_signal(c)
+#define COND_BROADCAST(c) perl_cond_broadcast(c)
+#define COND_WAIT(c, m) \
+ STMT_START { \
+ perl_cond_wait(c); \
+ SCHEDULE(); \
+ } STMT_END
+#define COND_DESTROY(c)
+
+#define THREAD_CREATE(t, f) f((t))
+#define THREAD_POST_CREATE(t) NOOP
+
+#define YIELD NOOP