MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / GetThreadCount

Function GetThreadCount

test_common/harness/ThreadPool.cpp:971–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

969}
970
971cl_uint GetThreadCount(void)
972{
973 // Lazily set up our threads
974#if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600)
975 cl_int err = !_InitOnceExecuteOnce(&threadpool_init_control,
976 _ThreadPool_Init, NULL, NULL);
977#elif defined(_WIN32)
978 if (threadpool_init_control == 0)
979 {
980#warning This is buggy and race prone. Find a better way.
981 ThreadPool_Init();
982 threadpool_init_control = 1;
983 }
984#else
985 cl_int err = pthread_once(&threadpool_init_control, ThreadPool_Init);
986 if (err)
987 {
988 log_error("Error %d from pthread_once. Unable to init threads. "
989 "ThreadPool_Do failed.\n",
990 err);
991 return err;
992 }
993#endif // !_WIN32
994
995 if (gThreadCount < 1) return 1;
996
997 return gThreadCount;
998}
999
1000#else
1001

Callers 15

TestMacro_Int_FloatFunction · 0.85
TestFunc_Half_Half_IntFunction · 0.85
TestMacro_Int_Half_HalfFunction · 0.85
TestFunc_Double_DoubleFunction · 0.85
TestFunc_Half_HalfFunction · 0.85

Calls 2

_InitOnceExecuteOnceFunction · 0.85
ThreadPool_InitFunction · 0.85

Tested by 15

TestMacro_Int_FloatFunction · 0.68
TestFunc_Half_Half_IntFunction · 0.68
TestMacro_Int_Half_HalfFunction · 0.68
TestFunc_Double_DoubleFunction · 0.68
TestFunc_Half_HalfFunction · 0.68