* @brief Proxy Windows @c CreateThread underneath a pthreads-like wrapper. */
| 60 | * @brief Proxy Windows @c CreateThread underneath a pthreads-like wrapper. |
| 61 | */ |
| 62 | static int pthread_create( |
| 63 | pthread_t* thread, |
| 64 | const pthread_attr_t* attribs, |
| 65 | void* (*threadfunc)(void*), |
| 66 | void* thread_arg |
| 67 | ) { |
| 68 | static_cast<void>(attribs); |
| 69 | LPTHREAD_START_ROUTINE func = reinterpret_cast<LPTHREAD_START_ROUTINE>(threadfunc); |
| 70 | *thread = CreateThread(nullptr, 0, func, thread_arg, 0, nullptr); |
| 71 | |
| 72 | // Ensure we return 0 on success, non-zero on error |
| 73 | if (*thread == NULL) |
| 74 | { |
| 75 | return 1; |
| 76 | } |
| 77 | |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @brief Manually set CPU group and thread affinity. |