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.

132 lines
2.2 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. void
  28. PyThread_exit_thread(void)
  29. {
  30. dprintf(("PyThread_exit_thread called\n"));
  31. if (!initialized)
  32. exit(0);
  33. }
  34. /*
  35. * Lock support.
  36. */
  37. PyThread_type_lock
  38. PyThread_allocate_lock(void)
  39. {
  40. dprintf(("PyThread_allocate_lock called\n"));
  41. if (!initialized)
  42. PyThread_init_thread();
  43. dprintf(("PyThread_allocate_lock() -> %p\n", lock));
  44. return (PyThread_type_lock) lock;
  45. }
  46. void
  47. PyThread_free_lock(PyThread_type_lock lock)
  48. {
  49. dprintf(("PyThread_free_lock(%p) called\n", lock));
  50. }
  51. int
  52. PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
  53. {
  54. return PyThread_acquire_lock_timed(lock, waitflag ? -1 : 0, 0);
  55. }
  56. PyLockStatus
  57. PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
  58. int intr_flag)
  59. {
  60. int success;
  61. dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) called\n", lock, microseconds, intr_flag));
  62. dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) -> %d\n",
  63. lock, microseconds, intr_flag, success));
  64. return success;
  65. }
  66. void
  67. PyThread_release_lock(PyThread_type_lock lock)
  68. {
  69. dprintf(("PyThread_release_lock(%p) called\n", lock));
  70. }
  71. /* The following are only needed if native TLS support exists */
  72. #define Py_HAVE_NATIVE_TLS
  73. #ifdef Py_HAVE_NATIVE_TLS
  74. int
  75. PyThread_create_key(void)
  76. {
  77. int result;
  78. return result;
  79. }
  80. void
  81. PyThread_delete_key(int key)
  82. {
  83. }
  84. int
  85. PyThread_set_key_value(int key, void *value)
  86. {
  87. int ok;
  88. /* A failure in this case returns -1 */
  89. if (!ok)
  90. return -1;
  91. return 0;
  92. }
  93. void *
  94. PyThread_get_key_value(int key)
  95. {
  96. void *result;
  97. return result;
  98. }
  99. void
  100. PyThread_delete_key_value(int key)
  101. {
  102. }
  103. void
  104. PyThread_ReInitTLS(void)
  105. {
  106. }
  107. #endif