Portability fixes. Now builds on Linux 2.2 and 2.4 and solaris.
Also builds on i386, alpha, G3/G4, and sparc.
This commit is contained in:
parent
0347bb1667
commit
7872c30111
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
public:
|
||||
int m_refCount;
|
||||
IArchMultithread::ThreadID m_id;
|
||||
pthread_t m_thread;
|
||||
IArchMultithread::ThreadFunc m_func;
|
||||
void* m_userData;
|
||||
|
@ -51,6 +52,7 @@ public:
|
|||
|
||||
CArchThreadImpl::CArchThreadImpl() :
|
||||
m_refCount(1),
|
||||
m_id(0),
|
||||
m_func(NULL),
|
||||
m_userData(NULL),
|
||||
m_cancel(false),
|
||||
|
@ -69,7 +71,8 @@ CArchThreadImpl::CArchThreadImpl() :
|
|||
CArchMultithreadPosix* CArchMultithreadPosix::s_instance = NULL;
|
||||
|
||||
CArchMultithreadPosix::CArchMultithreadPosix() :
|
||||
m_newThreadCalled(false)
|
||||
m_newThreadCalled(false),
|
||||
m_nextID(0)
|
||||
{
|
||||
assert(s_instance == NULL);
|
||||
|
||||
|
@ -505,6 +508,7 @@ bool
|
|||
CArchMultithreadPosix::waitForEvent(double /*timeout*/)
|
||||
{
|
||||
// not implemented
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -534,7 +538,7 @@ CArchMultithreadPosix::getResultOfThread(CArchThread thread)
|
|||
IArchMultithread::ThreadID
|
||||
CArchMultithreadPosix::getIDOfThread(CArchThread thread)
|
||||
{
|
||||
return reinterpret_cast<ThreadID>(reinterpret_cast<void*>(thread));
|
||||
return thread->m_id;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -601,6 +605,12 @@ CArchMultithreadPosix::insert(CArchThreadImpl* thread)
|
|||
// thread shouldn't already be on the list
|
||||
assert(findNoRef(thread->m_thread) == NULL);
|
||||
|
||||
// set thread id. note that we don't worry about m_nextID
|
||||
// wrapping back to 0 and duplicating thread ID's since the
|
||||
// likelihood of synergy running that long is vanishingly
|
||||
// small.
|
||||
thread->m_id = ++m_nextID;
|
||||
|
||||
// append to list
|
||||
m_threadList.push_back(thread);
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ private:
|
|||
CArchMutex m_threadMutex;
|
||||
CArchThread m_mainThread;
|
||||
CThreadList m_threadList;
|
||||
ThreadID m_nextID;
|
||||
|
||||
pthread_t m_signalThread;
|
||||
};
|
||||
|
|
|
@ -641,8 +641,9 @@ CArchNetworkBSD::addrToName(CArchNetAddress addr)
|
|||
|
||||
// mutexed name lookup (ugh)
|
||||
ARCH->lockMutex(m_mutex);
|
||||
struct hostent* info = gethostbyaddr(&addr->m_addr, addr->m_len,
|
||||
addr->m_addr.sa_family);
|
||||
struct hostent* info = gethostbyaddr(
|
||||
reinterpret_cast<const char*>(&addr->m_addr),
|
||||
addr->m_len, addr->m_addr.sa_family);
|
||||
if (info == NULL) {
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
throwNameError(h_errno);
|
||||
|
|
Loading…
Reference in New Issue