MThread *MThread::Start (void (*routine) (void *arg), void *arg) { MThread *newthr = new MThread (); newthr->routine = routine; newthr->arg = arg; int rc = pthread_create (&newthr->tid, NULL, thread_start_routine, newthr); if (rc) { newthr->DecRef (); return NULL; } return newthr; }
MThread *MThread::Start (void (*routine) (void *arg), void *arg) { DWORD dwtid; MThread *newthr = new MThread (); newthr->routine = routine; newthr->arg = arg; newthr->th = CreateThread (NULL, WIN32_THREAD_STACK_SIZE, thread_start_routine, newthr, 0, &dwtid); //newthr->th = (HANDLE)_beginthread(thread_start_routine, 0, newthr); if (!newthr->th) { newthr->DecRef (); return NULL; } return newthr; }