/
opt
/
imh
/
python3.13
/
include
/
python3.13
/
internal
/
/opt/imh/python3.13/include/python3.13/internal
mkdir
upload
Name
Size
Mode
Actions
mimalloc/
-
0755
rm
pycore_abstract.h
1915
0644
edit
dl
rm
pycore_asdl.h
3035
0644
edit
dl
rm
pycore_ast.h
31520
0644
edit
dl
rm
pycore_ast_state.h
6779
0644
edit
dl
rm
pycore_atexit.h
1433
0644
edit
dl
rm
pycore_backoff.h
3902
0644
edit
dl
rm
pycore_bitutils.h
6026
0644
edit
dl
rm
pycore_blocks_output_buffer.h
8772
0644
edit
dl
rm
pycore_brc.h
2102
0644
edit
dl
rm
pycore_bytesobject.h
5099
0644
edit
dl
rm
pycore_bytes_methods.h
3933
0644
edit
dl
rm
pycore_call.h
6135
0644
edit
dl
rm
pycore_capsule.h
397
0644
edit
dl
rm
pycore_cell.h
1057
0644
edit
dl
rm
pycore_ceval.h
11162
0644
edit
dl
rm
pycore_ceval_state.h
3921
0644
edit
dl
rm
pycore_code.h
19864
0644
edit
dl
rm
pycore_codecs.h
2465
0644
edit
dl
rm
pycore_compile.h
3750
0644
edit
dl
rm
pycore_complexobject.h
588
0644
edit
dl
rm
pycore_condvar.h
2704
0644
edit
dl
rm
pycore_context.h
1182
0644
edit
dl
rm
pycore_critical_section.h
7968
0644
edit
dl
rm
pycore_crossinterp.h
12128
0644
edit
dl
rm
pycore_descrobject.h
543
0644
edit
dl
rm
pycore_dict.h
12264
0644
edit
dl
rm
pycore_dict_state.h
732
0644
edit
dl
rm
pycore_dtoa.h
1727
0644
edit
dl
rm
pycore_emscripten_signal.h
685
0644
edit
dl
rm
pycore_emscripten_trampoline.h
3180
0644
edit
dl
rm
pycore_exceptions.h
900
0644
edit
dl
rm
pycore_faulthandler.h
2245
0644
edit
dl
rm
pycore_fileutils.h
9468
0644
edit
dl
rm
pycore_fileutils_windows.h
2713
0644
edit
dl
rm
pycore_floatobject.h
1495
0644
edit
dl
rm
pycore_flowgraph.h
1489
0644
edit
dl
rm
pycore_format.h
480
0644
edit
dl
rm
pycore_frame.h
10875
0644
edit
dl
rm
pycore_freelist.h
4810
0644
edit
dl
rm
pycore_function.h
1538
0644
edit
dl
rm
pycore_gc.h
12967
0644
edit
dl
rm
pycore_genobject.h
859
0644
edit
dl
rm
pycore_getopt.h
490
0644
edit
dl
rm
pycore_gil.h
2196
0644
edit
dl
rm
pycore_global_objects.h
3090
0644
edit
dl
rm
pycore_global_objects_fini_generated.h
117804
0644
edit
dl
rm
pycore_global_strings.h
26706
0644
edit
dl
rm
pycore_hamt.h
3742
0644
edit
dl
rm
pycore_hashtable.h
4361
0644
edit
dl
rm
pycore_identifier.h
515
0644
edit
dl
rm
pycore_import.h
7731
0644
edit
dl
rm
pycore_importdl.h
4055
0644
edit
dl
rm
pycore_initconfig.h
6375
0644
edit
dl
rm
pycore_instruction_sequence.h
2161
0644
edit
dl
rm
pycore_instruments.h
2331
0644
edit
dl
rm
pycore_interp.h
15063
0644
edit
dl
rm
pycore_intrinsics.h
1756
0644
edit
dl
rm
pycore_jit.h
527
0644
edit
dl
rm
pycore_list.h
1859
0644
edit
dl
rm
pycore_llist.h
2420
0644
edit
dl
rm
pycore_lock.h
8538
0644
edit
dl
rm
pycore_long.h
9966
0644
edit
dl
rm
pycore_memoryobject.h
427
0644
edit
dl
rm
pycore_mimalloc.h
1637
0644
edit
dl
rm
pycore_modsupport.h
3351
0644
edit
dl
rm
pycore_moduleobject.h
1572
0644
edit
dl
rm
pycore_namespace.h
435
0644
edit
dl
rm
pycore_object.h
27936
0644
edit
dl
rm
pycore_object_alloc.h
2176
0644
edit
dl
rm
pycore_object_stack.h
2384
0644
edit
dl
rm
pycore_object_state.h
942
0644
edit
dl
rm
pycore_obmalloc.h
27418
0644
edit
dl
rm
pycore_obmalloc_init.h
1935
0644
edit
dl
rm
pycore_opcode_metadata.h
84722
0644
edit
dl
rm
pycore_opcode_utils.h
2122
0644
edit
dl
rm
pycore_optimizer.h
8303
0644
edit
dl
rm
pycore_parking_lot.h
3351
0644
edit
dl
rm
pycore_parser.h
2089
0644
edit
dl
rm
pycore_pathconfig.h
658
0644
edit
dl
rm
pycore_pyarena.h
2862
0644
edit
dl
rm
pycore_pyatomic_ft_wrappers.h
8056
0644
edit
dl
rm
pycore_pybuffer.h
510
0644
edit
dl
rm
pycore_pyerrors.h
4960
0644
edit
dl
rm
pycore_pyhash.h
2813
0644
edit
dl
rm
pycore_pylifecycle.h
4465
0644
edit
dl
rm
pycore_pymath.h
8600
0644
edit
dl
rm
pycore_pymem.h
4485
0644
edit
dl
rm
pycore_pymem_init.h
3520
0644
edit
dl
rm
pycore_pystate.h
9964
0644
edit
dl
rm
pycore_pystats.h
420
0644
edit
dl
rm
pycore_pythonrun.h
758
0644
edit
dl
rm
pycore_pythread.h
5431
0644
edit
dl
rm
pycore_qsbr.h
5524
0644
edit
dl
rm
pycore_range.h
346
0644
edit
dl
rm
pycore_runtime.h
13165
0644
edit
dl
rm
pycore_runtime_init.h
13045
0644
edit
dl
rm
pycore_runtime_init_generated.h
46820
0644
edit
dl
rm
pycore_semaphore.h
1731
0644
edit
dl
rm
pycore_setobject.h
951
0644
edit
dl
rm
pycore_signal.h
2931
0644
edit
dl
rm
pycore_sliceobject.h
369
0644
edit
dl
rm
pycore_stackref.h
5186
0644
edit
dl
rm
pycore_strhex.h
1013
0644
edit
dl
rm
pycore_structseq.h
963
0644
edit
dl
rm
pycore_symtable.h
8671
0644
edit
dl
rm
pycore_sysmodule.h
1177
0644
edit
dl
rm
pycore_time.h
11794
0644
edit
dl
rm
pycore_token.h
3001
0644
edit
dl
rm
pycore_traceback.h
3629
0644
edit
dl
rm
pycore_tracemalloc.h
4533
0644
edit
dl
rm
pycore_tstate.h
1354
0644
edit
dl
rm
pycore_tuple.h
820
0644
edit
dl
rm
pycore_typeobject.h
8877
0644
edit
dl
rm
pycore_typevarobject.h
924
0644
edit
dl
rm
pycore_ucnhash.h
958
0644
edit
dl
rm
pycore_unicodeobject.h
13270
0644
edit
dl
rm
pycore_unicodeobject_generated.h
132140
0644
edit
dl
rm
pycore_unionobject.h
742
0644
edit
dl
rm
pycore_uop_ids.h
10267
0644
edit
dl
rm
pycore_uop_metadata.h
39469
0644
edit
dl
rm
pycore_warnings.h
840
0644
edit
dl
rm
pycore_weakref.h
3889
0644
edit
dl
rm
Edit:
/opt/imh/python3.13/include/python3.13/internal/pycore_critical_section.h
(7968B)
#ifndef Py_INTERNAL_CRITICAL_SECTION_H #define Py_INTERNAL_CRITICAL_SECTION_H #ifndef Py_BUILD_CORE # error "this header requires Py_BUILD_CORE define" #endif #include "pycore_lock.h" // PyMutex #include "pycore_pystate.h" // _PyThreadState_GET() #include <stdint.h> #ifdef __cplusplus extern "C" { #endif // Tagged pointers to critical sections use the two least significant bits to // mark if the pointed-to critical section is inactive and whether it is a // PyCriticalSection2 object. #define _Py_CRITICAL_SECTION_INACTIVE 0x1 #define _Py_CRITICAL_SECTION_TWO_MUTEXES 0x2 #define _Py_CRITICAL_SECTION_MASK 0x3 #ifdef Py_GIL_DISABLED # define Py_BEGIN_CRITICAL_SECTION_MUT(mutex) \ { \ PyCriticalSection _py_cs; \ _PyCriticalSection_BeginMutex(&_py_cs, mutex) # define Py_BEGIN_CRITICAL_SECTION2_MUT(m1, m2) \ { \ PyCriticalSection2 _py_cs2; \ _PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2) // Specialized version of critical section locking to safely use // PySequence_Fast APIs without the GIL. For performance, the argument *to* // PySequence_Fast() is provided to the macro, not the *result* of // PySequence_Fast(), which would require an extra test to determine if the // lock must be acquired. # define Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST(original) \ { \ PyObject *_orig_seq = _PyObject_CAST(original); \ const bool _should_lock_cs = PyList_CheckExact(_orig_seq); \ PyCriticalSection _cs; \ if (_should_lock_cs) { \ _PyCriticalSection_Begin(&_cs, _orig_seq); \ } # define Py_END_CRITICAL_SECTION_SEQUENCE_FAST() \ if (_should_lock_cs) { \ PyCriticalSection_End(&_cs); \ } \ } // Asserts that the mutex is locked. The mutex must be held by the // top-most critical section otherwise there's the possibility // that the mutex would be swalled out in some code paths. #define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex) \ _PyCriticalSection_AssertHeld(mutex) // Asserts that the mutex for the given object is locked. The mutex must // be held by the top-most critical section otherwise there's the // possibility that the mutex would be swalled out in some code paths. #ifdef Py_DEBUG # define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) \ if (Py_REFCNT(op) != 1) { \ _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(&_PyObject_CAST(op)->ob_mutex); \ } #else /* Py_DEBUG */ # define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) #endif /* Py_DEBUG */ #else /* !Py_GIL_DISABLED */ // The critical section APIs are no-ops with the GIL. # define Py_BEGIN_CRITICAL_SECTION_MUT(mut) { # define Py_BEGIN_CRITICAL_SECTION2_MUT(m1, m2) { # define Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST(original) { # define Py_END_CRITICAL_SECTION_SEQUENCE_FAST() } # define _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(mutex) # define _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op) #endif /* !Py_GIL_DISABLED */ // Resumes the top-most critical section. PyAPI_FUNC(void) _PyCriticalSection_Resume(PyThreadState *tstate); // (private) slow path for locking the mutex PyAPI_FUNC(void) _PyCriticalSection_BeginSlow(PyCriticalSection *c, PyMutex *m); PyAPI_FUNC(void) _PyCriticalSection2_BeginSlow(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2, int is_m1_locked); PyAPI_FUNC(void) _PyCriticalSection_SuspendAll(PyThreadState *tstate); #ifdef Py_GIL_DISABLED static inline int _PyCriticalSection_IsActive(uintptr_t tag) { return tag != 0 && (tag & _Py_CRITICAL_SECTION_INACTIVE) == 0; } static inline void _PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *m) { if (PyMutex_LockFast(&m->_bits)) { PyThreadState *tstate = _PyThreadState_GET(); c->_cs_mutex = m; c->_cs_prev = tstate->critical_section; tstate->critical_section = (uintptr_t)c; } else { _PyCriticalSection_BeginSlow(c, m); } } static inline void _PyCriticalSection_Begin(PyCriticalSection *c, PyObject *op) { _PyCriticalSection_BeginMutex(c, &op->ob_mutex); } #define PyCriticalSection_Begin _PyCriticalSection_Begin // Removes the top-most critical section from the thread's stack of critical // sections. If the new top-most critical section is inactive, then it is // resumed. static inline void _PyCriticalSection_Pop(PyCriticalSection *c) { PyThreadState *tstate = _PyThreadState_GET(); uintptr_t prev = c->_cs_prev; tstate->critical_section = prev; if ((prev & _Py_CRITICAL_SECTION_INACTIVE) != 0) { _PyCriticalSection_Resume(tstate); } } static inline void _PyCriticalSection_End(PyCriticalSection *c) { PyMutex_Unlock(c->_cs_mutex); _PyCriticalSection_Pop(c); } #define PyCriticalSection_End _PyCriticalSection_End static inline void _PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *m1, PyMutex *m2) { if (m1 == m2) { // If the two mutex arguments are the same, treat this as a critical // section with a single mutex. c->_cs_mutex2 = NULL; _PyCriticalSection_BeginMutex(&c->_cs_base, m1); return; } if ((uintptr_t)m2 < (uintptr_t)m1) { // Sort the mutexes so that the lower address is locked first. // The exact order does not matter, but we need to acquire the mutexes // in a consistent order to avoid lock ordering deadlocks. PyMutex *tmp = m1; m1 = m2; m2 = tmp; } if (PyMutex_LockFast(&m1->_bits)) { if (PyMutex_LockFast(&m2->_bits)) { PyThreadState *tstate = _PyThreadState_GET(); c->_cs_base._cs_mutex = m1; c->_cs_mutex2 = m2; c->_cs_base._cs_prev = tstate->critical_section; uintptr_t p = (uintptr_t)c | _Py_CRITICAL_SECTION_TWO_MUTEXES; tstate->critical_section = p; } else { _PyCriticalSection2_BeginSlow(c, m1, m2, 1); } } else { _PyCriticalSection2_BeginSlow(c, m1, m2, 0); } } static inline void _PyCriticalSection2_Begin(PyCriticalSection2 *c, PyObject *a, PyObject *b) { _PyCriticalSection2_BeginMutex(c, &a->ob_mutex, &b->ob_mutex); } #define PyCriticalSection2_Begin _PyCriticalSection2_Begin static inline void _PyCriticalSection2_End(PyCriticalSection2 *c) { if (c->_cs_mutex2) { PyMutex_Unlock(c->_cs_mutex2); } PyMutex_Unlock(c->_cs_base._cs_mutex); _PyCriticalSection_Pop(&c->_cs_base); } #define PyCriticalSection2_End _PyCriticalSection2_End static inline void _PyCriticalSection_AssertHeld(PyMutex *mutex) { #ifdef Py_DEBUG PyThreadState *tstate = _PyThreadState_GET(); uintptr_t prev = tstate->critical_section; if (prev & _Py_CRITICAL_SECTION_TWO_MUTEXES) { PyCriticalSection2 *cs = (PyCriticalSection2 *)(prev & ~_Py_CRITICAL_SECTION_MASK); assert(cs != NULL && (cs->_cs_base._cs_mutex == mutex || cs->_cs_mutex2 == mutex)); } else { PyCriticalSection *cs = (PyCriticalSection *)(tstate->critical_section & ~_Py_CRITICAL_SECTION_MASK); assert(cs != NULL && cs->_cs_mutex == mutex); } #endif } #endif /* Py_GIL_DISABLED */ #ifdef __cplusplus } #endif #endif /* !Py_INTERNAL_CRITICAL_SECTION_H */
Save
cmd:
run