Home | History | Annotate | Download | only in Python
      1 /*
      2  * Initialization.
      3  */
      4 static void
      5 PyThread__init_thread(void)
      6 {
      7 }
      8 
      9 /*
     10  * Thread support.
     11  */
     12 long
     13 PyThread_start_new_thread(void (*func)(void *), void *arg)
     14 {
     15     int success = 0;            /* init not needed when SOLARIS_THREADS and */
     16                 /* C_THREADS implemented properly */
     17 
     18     dprintf(("PyThread_start_new_thread called\n"));
     19     if (!initialized)
     20         PyThread_init_thread();
     21     return success < 0 ? -1 : 0;
     22 }
     23 
     24 long
     25 PyThread_get_thread_ident(void)
     26 {
     27     if (!initialized)
     28         PyThread_init_thread();
     29 }
     30 
     31 void
     32 PyThread_exit_thread(void)
     33 {
     34     dprintf(("PyThread_exit_thread called\n"));
     35     if (!initialized)
     36         exit(0);
     37 }
     38 
     39 /*
     40  * Lock support.
     41  */
     42 PyThread_type_lock
     43 PyThread_allocate_lock(void)
     44 {
     45 
     46     dprintf(("PyThread_allocate_lock called\n"));
     47     if (!initialized)
     48         PyThread_init_thread();
     49 
     50     dprintf(("PyThread_allocate_lock() -> %p\n", lock));
     51     return (PyThread_type_lock) lock;
     52 }
     53 
     54 void
     55 PyThread_free_lock(PyThread_type_lock lock)
     56 {
     57     dprintf(("PyThread_free_lock(%p) called\n", lock));
     58 }
     59 
     60 int
     61 PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
     62 {
     63     return PyThread_acquire_lock_timed(lock, waitflag ? -1 : 0, 0);
     64 }
     65 
     66 PyLockStatus
     67 PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
     68                             int intr_flag)
     69 {
     70     int success;
     71 
     72     dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) called\n", lock, microseconds, intr_flag));
     73     dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) -> %d\n",
     74 	     lock, microseconds, intr_flag, success));
     75     return success;
     76 }
     77 
     78 void
     79 PyThread_release_lock(PyThread_type_lock lock)
     80 {
     81     dprintf(("PyThread_release_lock(%p) called\n", lock));
     82 }
     83 
     84 /* The following are only needed if native TLS support exists */
     85 #define Py_HAVE_NATIVE_TLS
     86 
     87 #ifdef Py_HAVE_NATIVE_TLS
     88 int
     89 PyThread_create_key(void)
     90 {
     91     int result;
     92     return result;
     93 }
     94 
     95 void
     96 PyThread_delete_key(int key)
     97 {
     98 
     99 }
    100 
    101 int
    102 PyThread_set_key_value(int key, void *value)
    103 {
    104     int ok;
    105 
    106     /* A failure in this case returns -1 */
    107     if (!ok)
    108         return -1;
    109     return 0;
    110 }
    111 
    112 void *
    113 PyThread_get_key_value(int key)
    114 {
    115     void *result;
    116 
    117     return result;
    118 }
    119 
    120 void
    121 PyThread_delete_key_value(int key)
    122 {
    123 
    124 }
    125 
    126 void
    127 PyThread_ReInitTLS(void)
    128 {
    129 
    130 }
    131 
    132 #endif
    133