File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,3 +154,16 @@ _Py_RestoreSignals(void)
154154 PyOS_setsig (SIGXFSZ , SIG_DFL );
155155#endif
156156}
157+
158+ #ifdef _WIN32
159+ void PyOS_BeforeFork () {
160+ return ;
161+ }
162+ void PyOS_AfterFork_Parent () {
163+ return ;
164+ }
165+ void PyOS_AfterFork_Child () {
166+ return ;
167+ }
168+
169+ #endif
Original file line number Diff line number Diff line change @@ -81,8 +81,30 @@ cdef extern from "includes/fork_handler.h":
8181 void (* parent)(),
8282 void (* child)())
8383
84- # TODO: windows needs statomic.h and a few other Things. Might need a reviewer for help.
84+
8585cdef extern from * nogil:
86+ """
87+ #ifdef _WIN32
88+ static inline uint64_t
89+ __win_atomic_fetch_add(uint64_t *ptr, uint64_t val){
90+ return *ptr = *(volatile uint64_t *)ptr + val;
91+ }
92+
93+ static inline uint64_t
94+ __win_atomic_fetch_sub(uint64_t *ptr, uint64_t val){
95+ return *ptr = *(volatile uint64_t *)ptr - val;
96+ }
97+
98+ #define __atomic_fetch_add(ptr, val, memorder) \
99+ __win_atomic_fetch_add(ptr, val)
100+
101+ #define __atomic_fetch_sub(ptr, val, memorder) \
102+ __win_atomic_fetch_sub(ptr, val)
103+
104+ /* We need ATOMIC RELAXED still */
105+ #define __ATOMIC_RELAXED 0
106+ #endif /* _WIN32 */
107+ """
86108 uint64_t __atomic_fetch_add(uint64_t * ptr, uint64_t val, int memorder)
87109 uint64_t __atomic_fetch_sub(uint64_t * ptr, uint64_t val, int memorder)
88110
You can’t perform that action at this time.
0 commit comments