/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
//////////////////////////////////////////////////////////////////////////
//
// This file contains the linux implementation of the Thread class
///////////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "Thread.h"
#include <pthread.h>
#include <cerrno>
#include <cstdio>
class OSThread
{
public:
bool _running;
static void *threadFunc(void * thread_p);
};
{
if (thread_p) {
//printf("@@@@ OSThread::threadFunc (%p)\n", t->_osThread);
t->run();
//printf("@@@@ OSThread::threadFunc (%p) after run\n", t->_osThread);
//printf("@@@@ OSThread::threadFunc setting signal\n");
}
return (void *)0;
}
{
}
{
delete _osThread;
}
{
return pthread_self();
}
{
int retcode = 0;
if (msecs_p != WAIT_INFINITE) {
}
return false;
} else {
return true;
}
} else {
//printf("@@@@ Thread wait (%p), running: %d\n", _osThread, _osThread->_running);
}
//printf("@@@@ Thread after wait\n");
return true;
}
}
{
if (running() == false) {
return false;
}
}
return true;
}
{
}
{
while (counter > 0) {
// nanosleep might return due to a signal, in which case
// rem will include the remaining time
--counter;
} else {
break;
}
}
}
{
}
}
{
}