MCPcopy Create free account
hub / github.com/cesanta/mongoose / start_thread

Function start_thread

tutorials/core/multi-threaded/main.c:11–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "mongoose.h"
10
11static 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
26struct thread_data {
27 struct mg_mgr *mgr;

Callers 1

fnFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected