X7ROOT File Manager
Current Path:
/opt/alt/python313/include/python3.13/internal
opt
/
alt
/
python313
/
include
/
python3.13
/
internal
/
ðŸ“
..
ðŸ“
mimalloc
📄
pycore_abstract.h
(1.87 KB)
📄
pycore_asdl.h
(2.96 KB)
📄
pycore_ast.h
(30.78 KB)
📄
pycore_ast_state.h
(6.62 KB)
📄
pycore_atexit.h
(1.4 KB)
📄
pycore_backoff.h
(3.81 KB)
📄
pycore_bitutils.h
(5.88 KB)
📄
pycore_blocks_output_buffer.h
(8.57 KB)
📄
pycore_brc.h
(2.05 KB)
📄
pycore_bytes_methods.h
(3.84 KB)
📄
pycore_bytesobject.h
(4.75 KB)
📄
pycore_call.h
(5.99 KB)
📄
pycore_capsule.h
(397 B)
📄
pycore_cell.h
(1.03 KB)
📄
pycore_ceval.h
(10.9 KB)
📄
pycore_ceval_state.h
(3.83 KB)
📄
pycore_code.h
(19.4 KB)
📄
pycore_codecs.h
(2.41 KB)
📄
pycore_compile.h
(3.66 KB)
📄
pycore_complexobject.h
(588 B)
📄
pycore_condvar.h
(2.64 KB)
📄
pycore_context.h
(1.15 KB)
📄
pycore_critical_section.h
(7.78 KB)
📄
pycore_crossinterp.h
(11.84 KB)
📄
pycore_descrobject.h
(543 B)
📄
pycore_dict.h
(11.98 KB)
📄
pycore_dict_state.h
(732 B)
📄
pycore_dtoa.h
(1.69 KB)
📄
pycore_emscripten_signal.h
(685 B)
📄
pycore_emscripten_trampoline.h
(3.11 KB)
📄
pycore_exceptions.h
(900 B)
📄
pycore_faulthandler.h
(2.19 KB)
📄
pycore_fileutils.h
(9.25 KB)
📄
pycore_fileutils_windows.h
(2.65 KB)
📄
pycore_floatobject.h
(1.46 KB)
📄
pycore_flowgraph.h
(1.45 KB)
📄
pycore_format.h
(480 B)
📄
pycore_frame.h
(10.62 KB)
📄
pycore_freelist.h
(4.7 KB)
📄
pycore_function.h
(1.5 KB)
📄
pycore_gc.h
(12.66 KB)
📄
pycore_genobject.h
(859 B)
📄
pycore_getopt.h
(490 B)
📄
pycore_gil.h
(2.14 KB)
📄
pycore_global_objects.h
(3.02 KB)
📄
pycore_global_objects_fini_generated.h
(115.04 KB)
📄
pycore_global_strings.h
(26.08 KB)
📄
pycore_hamt.h
(3.65 KB)
📄
pycore_hashtable.h
(4.26 KB)
📄
pycore_identifier.h
(515 B)
📄
pycore_import.h
(7.55 KB)
📄
pycore_importdl.h
(3.96 KB)
📄
pycore_initconfig.h
(6.23 KB)
📄
pycore_instruction_sequence.h
(2.11 KB)
📄
pycore_instruments.h
(2.28 KB)
📄
pycore_interp.h
(14.71 KB)
📄
pycore_intrinsics.h
(1.71 KB)
📄
pycore_jit.h
(527 B)
📄
pycore_list.h
(1.82 KB)
📄
pycore_llist.h
(2.36 KB)
📄
pycore_lock.h
(8.34 KB)
📄
pycore_long.h
(9.73 KB)
📄
pycore_memoryobject.h
(427 B)
📄
pycore_mimalloc.h
(1.6 KB)
📄
pycore_modsupport.h
(3.27 KB)
📄
pycore_moduleobject.h
(1.54 KB)
📄
pycore_namespace.h
(435 B)
📄
pycore_object.h
(26.64 KB)
📄
pycore_object_alloc.h
(2.13 KB)
📄
pycore_object_stack.h
(2.33 KB)
📄
pycore_object_state.h
(942 B)
📄
pycore_obmalloc.h
(26.78 KB)
📄
pycore_obmalloc_init.h
(1.89 KB)
📄
pycore_opcode_metadata.h
(82.74 KB)
📄
pycore_opcode_utils.h
(2.07 KB)
📄
pycore_optimizer.h
(8.11 KB)
📄
pycore_parking_lot.h
(3.27 KB)
📄
pycore_parser.h
(2.04 KB)
📄
pycore_pathconfig.h
(658 B)
📄
pycore_pyarena.h
(2.79 KB)
📄
pycore_pyatomic_ft_wrappers.h
(7.87 KB)
📄
pycore_pybuffer.h
(510 B)
📄
pycore_pyerrors.h
(4.84 KB)
📄
pycore_pyhash.h
(2.75 KB)
📄
pycore_pylifecycle.h
(4.36 KB)
📄
pycore_pymath.h
(8.4 KB)
📄
pycore_pymem.h
(4.37 KB)
📄
pycore_pymem_init.h
(3.44 KB)
📄
pycore_pystate.h
(9.73 KB)
📄
pycore_pystats.h
(420 B)
📄
pycore_pythonrun.h
(758 B)
📄
pycore_pythread.h
(5.3 KB)
📄
pycore_qsbr.h
(4.81 KB)
📄
pycore_range.h
(346 B)
📄
pycore_runtime.h
(12.84 KB)
📄
pycore_runtime_init.h
(12.74 KB)
📄
pycore_runtime_init_generated.h
(45.72 KB)
📄
pycore_semaphore.h
(1.69 KB)
📄
pycore_setobject.h
(951 B)
📄
pycore_signal.h
(2.86 KB)
📄
pycore_sliceobject.h
(369 B)
📄
pycore_stackref.h
(5.06 KB)
📄
pycore_strhex.h
(1013 B)
📄
pycore_structseq.h
(963 B)
📄
pycore_symtable.h
(8.47 KB)
📄
pycore_sysmodule.h
(1.15 KB)
📄
pycore_time.h
(11.52 KB)
📄
pycore_token.h
(2.93 KB)
📄
pycore_traceback.h
(3.54 KB)
📄
pycore_tracemalloc.h
(4.43 KB)
📄
pycore_tstate.h
(1.32 KB)
📄
pycore_tuple.h
(820 B)
📄
pycore_typeobject.h
(8.67 KB)
📄
pycore_typevarobject.h
(924 B)
📄
pycore_ucnhash.h
(958 B)
📄
pycore_unicodeobject.h
(12.15 KB)
📄
pycore_unicodeobject_generated.h
(129.04 KB)
📄
pycore_unionobject.h
(742 B)
📄
pycore_uop_ids.h
(10.03 KB)
📄
pycore_uop_metadata.h
(38.54 KB)
📄
pycore_warnings.h
(840 B)
📄
pycore_weakref.h
(3.25 KB)
Editing: pycore_critical_section.h
#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 */
Upload File
Create Folder