1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Change start_routine argument

Directly pass the thread pointer.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-08-09 14:19:44 +01:00
parent bc6a6e04a0
commit 7d5b8fcf77

View file

@ -33,17 +33,17 @@ namespace { extern "C" {
#if defined(_MSC_VER) #if defined(_MSC_VER)
DWORD WINAPI start_routine(LPVOID threadID) { DWORD WINAPI start_routine(LPVOID thread) {
Threads[*(int*)threadID].idle_loop(NULL); ((Thread*)thread)->idle_loop(NULL);
return 0; return 0;
} }
#else #else
void* start_routine(void* threadID) { void* start_routine(void* thread) {
Threads[*(int*)threadID].idle_loop(NULL); ((Thread*)thread)->idle_loop(NULL);
return NULL; return NULL;
} }
@ -173,15 +173,15 @@ void ThreadsManager::init() {
threads[i].threadID = i; threads[i].threadID = i;
#if defined(_MSC_VER) #if defined(_MSC_VER)
threads[i].handle = CreateThread(NULL, 0, start_routine, (LPVOID)&threads[i].threadID, 0, NULL); threads[i].handle = CreateThread(NULL, 0, start_routine, (LPVOID)&threads[i], 0, NULL);
bool ok = (threads[i].handle != NULL); bool ok = (threads[i].handle != NULL);
#else #else
bool ok = (pthread_create(&threads[i].handle, NULL, start_routine, (void*)&threads[i].threadID) == 0); bool ok = (pthread_create(&threads[i].handle, NULL, start_routine, (void*)&threads[i]) == 0);
#endif #endif
if (!ok) if (!ok)
{ {
std::cout << "Failed to create thread number " << i << std::endl; std::cerr << "Failed to create thread number " << i << std::endl;
::exit(EXIT_FAILURE); ::exit(EXIT_FAILURE);
} }
} }