File: pythread.pxd

package info (click to toggle)
cython 0.25.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,768 kB
  • sloc: python: 61,303; ansic: 11,484; cpp: 1,105; xml: 1,031; makefile: 397; lisp: 206; sed: 11; sh: 7
file content (40 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40


cdef extern from "pythread.h":

    ctypedef void *PyThread_type_lock
    ctypedef void *PyThread_type_sema

    void PyThread_init_thread()
    long PyThread_start_new_thread(void (*)(void *), void *)
    void PyThread_exit_thread()
    long PyThread_get_thread_ident()

    PyThread_type_lock PyThread_allocate_lock()
    void PyThread_free_lock(PyThread_type_lock)
    int PyThread_acquire_lock(PyThread_type_lock, int mode) nogil
    void PyThread_release_lock(PyThread_type_lock) nogil

    enum:
        # 'mode' in PyThread_acquire_lock()
        WAIT_LOCK    #   1
        NOWAIT_LOCK  #   0

    ctypedef enum PyLockStatus:
        # return values of PyThread_acquire_lock() in CPython 3.2+
        PY_LOCK_FAILURE = 0
        PY_LOCK_ACQUIRED = 1
        PY_LOCK_INTR

    size_t PyThread_get_stacksize()
    int PyThread_set_stacksize(size_t)

    # Thread Local Storage (TLS) API
    int PyThread_create_key()
    void PyThread_delete_key(int)
    int PyThread_set_key_value(int, void *)
    void * PyThread_get_key_value(int)
    void PyThread_delete_key_value(int key)

    # Cleanup after a fork
    void PyThread_ReInitTLS()