Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.6 KiB

  1. typedef int perl_mutex;
  2. typedef int perl_key;
  3. typedef struct perl_thread *perl_os_thread;
  4. /* With fake threads, thr is global(ish) so we don't need dTHR */
  5. #define dTHR extern int errno
  6. struct perl_wait_queue {
  7. struct perl_thread * thread;
  8. struct perl_wait_queue * next;
  9. };
  10. typedef struct perl_wait_queue *perl_cond;
  11. /* Ask thread.h to include our per-thread extras */
  12. #define HAVE_THREAD_INTERN
  13. struct thread_intern {
  14. perl_os_thread next_run, prev_run; /* Linked list of runnable threads */
  15. perl_cond wait_queue; /* Wait queue that we are waiting on */
  16. IV private; /* Holds data across time slices */
  17. I32 savemark; /* Holds MARK for thread join values */
  18. };
  19. #define init_thread_intern(t) \
  20. STMT_START { \
  21. t->self = (t); \
  22. (t)->i.next_run = (t)->i.prev_run = (t); \
  23. (t)->i.wait_queue = 0; \
  24. (t)->i.private = 0; \
  25. } STMT_END
  26. /*
  27. * Note that SCHEDULE() is only callable from pp code (which
  28. * must be expecting to be restarted). We'll have to do
  29. * something a bit different for XS code.
  30. */
  31. #define SCHEDULE() return schedule(), PL_op
  32. #define MUTEX_LOCK(m)
  33. #define MUTEX_UNLOCK(m)
  34. #define MUTEX_INIT(m)
  35. #define MUTEX_DESTROY(m)
  36. #define COND_INIT(c) perl_cond_init(c)
  37. #define COND_SIGNAL(c) perl_cond_signal(c)
  38. #define COND_BROADCAST(c) perl_cond_broadcast(c)
  39. #define COND_WAIT(c, m) \
  40. STMT_START { \
  41. perl_cond_wait(c); \
  42. SCHEDULE(); \
  43. } STMT_END
  44. #define COND_DESTROY(c)
  45. #define THREAD_CREATE(t, f) f((t))
  46. #define THREAD_POST_CREATE(t) NOOP
  47. #define YIELD NOOP