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.

115 lines
2.0 KiB

  1. /*
  2. * Initialization.
  3. */
  4. static void
  5. PyThread__init_thread(void)
  6. {
  7. }
  8. /*
  9. * Thread support.
  10. */
  11. long
  12. PyThread_start_new_thread(void (*func)(void *), void *arg)
  13. {
  14. int success = 0; /* init not needed when SOLARIS_THREADS and */
  15. /* C_THREADS implemented properly */
  16. dprintf(("PyThread_start_new_thread called\n"));
  17. if (!initialized)
  18. PyThread_init_thread();
  19. return success < 0 ? -1 : 0;
  20. }
  21. long
  22. PyThread_get_thread_ident(void)
  23. {
  24. if (!initialized)
  25. PyThread_init_thread();
  26. }
  27. static
  28. void do_PyThread_exit_thread(int no_cleanup)
  29. {
  30. dprintf(("PyThread_exit_thread called\n"));
  31. if (!initialized)
  32. if (no_cleanup)
  33. _exit(0);
  34. else
  35. exit(0);
  36. }
  37. void
  38. PyThread_exit_thread(void)
  39. {
  40. do_PyThread_exit_thread(0);
  41. }
  42. void
  43. PyThread__exit_thread(void)
  44. {
  45. do_PyThread_exit_thread(1);
  46. }
  47. #ifndef NO_EXIT_PROG
  48. static
  49. void do_PyThread_exit_prog(int status, int no_cleanup)
  50. {
  51. dprintf(("PyThread_exit_prog(%d) called\n", status));
  52. if (!initialized)
  53. if (no_cleanup)
  54. _exit(status);
  55. else
  56. exit(status);
  57. }
  58. void
  59. PyThread_exit_prog(int status)
  60. {
  61. do_PyThread_exit_prog(status, 0);
  62. }
  63. void
  64. PyThread__exit_prog(int status)
  65. {
  66. do_PyThread_exit_prog(status, 1);
  67. }
  68. #endif /* NO_EXIT_PROG */
  69. /*
  70. * Lock support.
  71. */
  72. PyThread_type_lock
  73. PyThread_allocate_lock(void)
  74. {
  75. dprintf(("PyThread_allocate_lock called\n"));
  76. if (!initialized)
  77. PyThread_init_thread();
  78. dprintf(("PyThread_allocate_lock() -> %p\n", lock));
  79. return (PyThread_type_lock) lock;
  80. }
  81. void
  82. PyThread_free_lock(PyThread_type_lock lock)
  83. {
  84. dprintf(("PyThread_free_lock(%p) called\n", lock));
  85. }
  86. int
  87. PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
  88. {
  89. int success;
  90. dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
  91. dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
  92. return success;
  93. }
  94. void
  95. PyThread_release_lock(PyThread_type_lock lock)
  96. {
  97. dprintf(("PyThread_release_lock(%p) called\n", lock));
  98. }