mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Use semaphore/mutex insted of pipe for threads sync
This commit is contained in:
1 parent
ba2584cebf
commit
ada24a98ec
7 files changed
+29
-25
No files matched your search
+7
-6
@@ -521,13 +521,14 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
||||
pthread_mutex_init(&rad_mutex, NULL);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
if(!CreatePipe(&conf.threadinit[0], &conf.threadinit[1], NULL, 1)){
|
||||
#else
|
||||
if(pipe(conf.threadinit)) {
|
||||
#endif
|
||||
fprintf(stderr, "CreatePipe failed\n");
|
||||
conf.threadinit = CreateSemaphore(NULL, 0, 1, NULL);
|
||||
if(!conf.threadinit){
|
||||
fprintf(stderr, "semaphore init failed\n");
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
#else
|
||||
pthread_mutex_init(&conf.threadinit, NULL);
|
||||
#endif
|
||||
|
||||
freeconf(&conf);
|
||||
res = readconfig(fp);
|
||||
|
||||
Reference in new issue
Block a user