Ejemplo n.º 1
0
void *MThread_helper( void *arg )
{
  MThread *me;

  me=(MThread *)arg;
  return( me->Run() );
}
Ejemplo n.º 2
0
static void *thread_start_routine (void *arg)
{
    MThread *newthr = (MThread *)arg;
    pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
    newthr->routine (newthr->arg);
    return NULL;
}
Ejemplo n.º 3
0
static DWORD WINAPI thread_start_routine (void *arg)
//static void thread_start_routine (void *arg)
{
    MThread *newthr = (MThread *)arg;
    newthr->id = GetCurrentThreadId ();
    newthr->routine (newthr->arg);
    return 0;
}
Ejemplo n.º 4
0
void* MThread::ThreadFunction(void* aPtr)
{
	MThread* pThrd = reinterpret_cast<MThread*>(aPtr);

	if (pThrd)
		pThrd->Run();

	return NULL;
};
Ejemplo n.º 5
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.º 6
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;
}
Ejemplo n.º 7
0
void* worker(void* arg){
	MThread* threadObj = (MThread*)arg;
	threadObj->run();
	threadObj->threadId = 0;
	return NULL;
}
Ejemplo n.º 8
0
bool is_current_thread(MThread &thread)
{
    return QThread::currentThread() == thread.qthread();
}