Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
}