MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ThreadCreate

Function ThreadCreate

Libraries/unrar/threadmisc.cpp:42–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42static THREAD_HANDLE ThreadCreate(NATIVE_THREAD_PTR Proc,void *Data)
43{
44#ifdef _UNIX
45/*
46 pthread_attr_t attr;
47 pthread_attr_init(&attr);
48 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
49*/
50 pthread_t pt;
51 int Code=pthread_create(&pt,NULL/*&attr*/,Proc,Data);
52 if (Code!=0)
53 {
54 wchar Msg[100];
55 swprintf(Msg,ASIZE(Msg),L"\npthread_create failed, code %d\n",Code);
56 ErrHandler.GeneralErrMsg(Msg);
57 ErrHandler.SysErrMsg();
58 ErrHandler.Exit(RARX_FATAL);
59 }
60 return pt;
61#else
62 DWORD ThreadId;
63 HANDLE hThread=CreateThread(NULL,0x10000,Proc,Data,0,&ThreadId);
64 if (hThread==NULL)
65 {
66 ErrHandler.GeneralErrMsg(L"CreateThread failed");
67 ErrHandler.SysErrMsg();
68 ErrHandler.Exit(RARX_FATAL);
69 }
70 return hThread;
71#endif
72}
73
74
75static void ThreadClose(THREAD_HANDLE hThread)

Callers 1

CreateThreadsMethod · 0.85

Calls 3

GeneralErrMsgMethod · 0.80
SysErrMsgMethod · 0.80
ExitMethod · 0.80

Tested by

no test coverage detected