Files
typthon/Modules/_multiprocessing/multiprocessing.h
copilot-swe-agent[bot] b198f511d2 Rename Py_ to Ty_ throughout C API
Massive automated renaming of all Py_/PyObject/etc. prefixes to Ty_/TyObject/etc.
This includes:
- All public API types (TyObject, TyTypeObject, etc.)
- All public API functions (Ty_Initialize, Ty_BuildValue, etc.)
- All internal API (_Ty_ prefixes)
- Reference counting macros (Ty_INCREF, Ty_DECREF, etc.)
- Type flags (Ty_TPFLAGS_*)
- Debug flags (Ty_DEBUG, Ty_TRACE_REFS, etc.)
- All object type APIs (TyList_, TyDict_, TyUnicode_, etc.)

This changes over 60,000 occurrences across 1000+ files.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-29 17:37:49 +00:00

105 lines
2.4 KiB
C

#ifndef MULTIPROCESSING_H
#define MULTIPROCESSING_H
#ifndef Ty_BUILD_CORE_BUILTIN
# define Ty_BUILD_CORE_MODULE 1
#endif
#include "Python.h"
#include "structmember.h"
#include "pythread.h"
#include "pycore_signal.h" // _TyOS_IsMainThread()
#ifndef MS_WINDOWS
# include <unistd.h> // sysconf()
#endif
/*
* Platform includes and definitions
*/
#ifdef MS_WINDOWS
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock2.h>
# include <process.h> /* getpid() */
# ifdef Ty_DEBUG
# include <crtdbg.h>
# endif
# define SEM_HANDLE HANDLE
# define SEM_VALUE_MAX LONG_MAX
# define HAVE_MP_SEMAPHORE
#else
# include <fcntl.h> /* O_CREAT and O_EXCL */
# if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)
# define HAVE_MP_SEMAPHORE
# include <semaphore.h>
typedef sem_t *SEM_HANDLE;
# endif
#endif
/*
* Issue 3110 - Solaris does not define SEM_VALUE_MAX
*/
#ifndef SEM_VALUE_MAX
#if defined(HAVE_SYSCONF) && defined(_SC_SEM_VALUE_MAX)
# define SEM_VALUE_MAX sysconf(_SC_SEM_VALUE_MAX)
#elif defined(_SEM_VALUE_MAX)
# define SEM_VALUE_MAX _SEM_VALUE_MAX
#elif defined(_POSIX_SEM_VALUE_MAX)
# define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX
#else
# define SEM_VALUE_MAX INT_MAX
#endif
#endif
/*
* Format codes
*/
#if SIZEOF_VOID_P == SIZEOF_LONG
# define F_POINTER "k"
# define T_POINTER T_ULONG
#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
# define F_POINTER "K"
# define T_POINTER T_ULONGLONG
#else
# error "can't find format code for unsigned integer of same size as void*"
#endif
#ifdef MS_WINDOWS
# define F_HANDLE F_POINTER
# define T_HANDLE T_POINTER
# define F_SEM_HANDLE F_HANDLE
# define T_SEM_HANDLE T_HANDLE
#else
# define F_HANDLE "i"
# define T_HANDLE T_INT
# define F_SEM_HANDLE F_POINTER
# define T_SEM_HANDLE T_POINTER
#endif
/*
* Error codes which can be returned by functions called without GIL
*/
#define MP_SUCCESS (0)
#define MP_STANDARD_ERROR (-1)
#define MP_MEMORY_ERROR (-1001)
#define MP_SOCKET_ERROR (-1002)
#define MP_EXCEPTION_HAS_BEEN_SET (-1003)
TyObject *_PyMp_SetError(TyObject *Type, int num);
/*
* Externs - not all will really exist on all platforms
*/
extern TyType_Spec _PyMp_SemLockType_spec;
extern TyObject *_PyMp_sem_unlink(const char *name);
#endif /* MULTIPROCESSING_H */