| 114 | |
| 115 | |
| 116 | int AttachCallback(void *voidInitializeThreadingInfo) { |
| 117 | // initialize us for threading, this will acquire the GIL if not already created, and is a nop if the GIL is created. |
| 118 | // This leaves us in the proper state when we return back to the runtime whether the GIL was created or not before |
| 119 | // we were called. |
| 120 | InitializeThreadingInfo* initializeThreadingInfo = reinterpret_cast<InitializeThreadingInfo*>(voidInitializeThreadingInfo); |
| 121 | initializeThreadingInfo->initThreads(); // Note: calling multiple times is ok. |
| 122 | initializeThreadingInfo->pyImportMod("threading"); |
| 123 | |
| 124 | EnterCriticalSection(&initializeThreadingInfo->cs); |
| 125 | initializeThreadingInfo->completed = true; |
| 126 | if(initializeThreadingInfo->initedEvent != nullptr) { |
| 127 | SetEvent(initializeThreadingInfo->initedEvent); |
| 128 | } |
| 129 | LeaveCriticalSection(&initializeThreadingInfo->cs); |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | // create a custom heap for our unordered map. This is necessary because if we suspend a thread while in a heap function |
nothing calls this directly
no test coverage detected