From: Christian P. <cp...@us...> - 2005-02-07 18:29:28
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16689/src/System Modified Files: Condition.posix.cpp Mutex.posix.cpp Log Message: Fixed SIGSEGV in POSIX Conditon implementation. Added note in POSIX Mutex implementation. Index: Mutex.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Mutex.posix.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Mutex.posix.cpp 23 Jan 2005 13:28:55 -0000 1.2 +++ Mutex.posix.cpp 7 Feb 2005 18:29:14 -0000 1.3 @@ -37,6 +37,9 @@ pthread_mutex_t mutex; }; +// There is a ugly HACK in Condition.posix.cpp that relies on the layout +// of this structure. When changing this struct don't forget to change it +// in Condition.posix.cpp! struct Mutex::Handle { SharedMemory* shmem; RealHandle* realHandle; Index: Condition.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Condition.posix.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Condition.posix.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ Condition.posix.cpp 7 Feb 2005 18:29:14 -0000 1.2 @@ -72,9 +72,20 @@ } /* UGLY HACK STARTS HERE */ +struct RealMutexHandle { + pthread_mutex_t mutex; +}; + +class SharedMemory; + class _MyMutex { public: - struct Handle { pthread_mutex_t mutex; }; + struct Handle { + SharedMemory* shmem; + RealMutexHandle* realHandle; + RealMutexHandle _realHandle; + }; + Handle* _handle; }; @@ -85,7 +96,7 @@ pthread_mutex_t* mutex_get_handle(Mutex::ScopedLock& lck) { - return &(((_MyLock&)lck)._mutex->_handle->mutex); + return &(((_MyLock&)lck)._mutex->_handle->realHandle->mutex); } /* END OF UGLY HACK */ |