cython

Форк
0
/
pythread.pxd 
51 строка · 1.9 Кб
1

2

3
cdef extern from "pythread.h":
4

5
    ctypedef void *PyThread_type_lock
6
    ctypedef void *PyThread_type_sema
7

8
    void PyThread_init_thread()
9
    long PyThread_start_new_thread(void (*)(void *), void *)  # FIXME: legacy
10
    #unsigned long PyThread_start_new_thread(void (*)(void *), void *)  # returned 'long' before Py3.7
11
    void PyThread_exit_thread()
12
    long PyThread_get_thread_ident()  # FIXME: legacy
13
    #unsigned long PyThread_get_thread_ident()  # returned 'long' before Py3.7
14

15
    PyThread_type_lock PyThread_allocate_lock()
16
    void PyThread_free_lock(PyThread_type_lock)
17
    int PyThread_acquire_lock(PyThread_type_lock, int mode) nogil
18
    void PyThread_release_lock(PyThread_type_lock) nogil
19

20
    enum:
21
        # 'mode' in PyThread_acquire_lock()
22
        WAIT_LOCK    #   1
23
        NOWAIT_LOCK  #   0
24

25
    ctypedef enum PyLockStatus:
26
        # return values of PyThread_acquire_lock() in CPython 3.2+
27
        PY_LOCK_FAILURE = 0
28
        PY_LOCK_ACQUIRED = 1
29
        PY_LOCK_INTR
30

31
    size_t PyThread_get_stacksize()
32
    int PyThread_set_stacksize(size_t)
33

34
    # Thread Local Storage (TLS) API deprecated in CPython 3.7+
35
    int PyThread_create_key()
36
    void PyThread_delete_key(int)
37
    int PyThread_set_key_value(int, void *)
38
    void * PyThread_get_key_value(int)
39
    void PyThread_delete_key_value(int key)
40

41
    # Cleanup after a fork
42
    void PyThread_ReInitTLS()
43

44
    # Thread Specific Storage (TSS) API in CPython 3.7+ (also backported)
45
    #ctypedef struct Py_tss_t: pass   # Cython built-in type
46
    Py_tss_t Py_tss_NEEDS_INIT        # Not normally useful: Cython auto-initialises declared "Py_tss_t" variables.
47
    Py_tss_t * PyThread_tss_alloc()
48
    void PyThread_tss_free(Py_tss_t *key)
49
    int PyThread_tss_is_created(Py_tss_t *key)
50
    int PyThread_tss_create(Py_tss_t *key)
51
    void PyThread_tss_delete(Py_tss_t *key)
52
    int PyThread_tss_set(Py_tss_t *key, void *value)
53
    void * PyThread_tss_get(Py_tss_t *key)
54

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.