| 9 | #include "mongoose.h" |
| 10 | |
| 11 | static void start_thread(void *(*f)(void *), void *p) { |
| 12 | #ifdef _WIN32 |
| 13 | _beginthread((void(__cdecl *)(void *)) f, 0, p); |
| 14 | #else |
| 15 | #define closesocket(x) close(x) |
| 16 | #include <pthread.h> |
| 17 | pthread_t thread_id = (pthread_t) 0; |
| 18 | pthread_attr_t attr; |
| 19 | (void) pthread_attr_init(&attr); |
| 20 | (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
| 21 | pthread_create(&thread_id, &attr, f, p); |
| 22 | pthread_attr_destroy(&attr); |
| 23 | #endif |
| 24 | } |
| 25 | |
| 26 | struct thread_data { |
| 27 | struct mg_mgr *mgr; |