From: Ulrich E. <Doo...@kn...> - 2001-02-14 00:42:39
|
Tuesday 13 February 2001 13:59 AD, masahiro minami wrote < As you see in mutex.cpp, it does nothing on Mac, and I have no idea...:= ( < Actually Max had written a test class for Mac, but it's not fully teste= d < ( it didn't work as it was ). Mutex: bool m_locked lock(): while(m_locked) YieldToAnyThread() m_locked =3D true; unlock() assert(m_locked) m_locked =3D false; Optionally, you could save the ID of the thread that locked it and catch=20 unlocks by other threads. I=B4ve been having a look at the thread-code: LoopThread::mac_ThreadFunction is effectively a no-op, I think it can be=20 removed. About the rest: I have merged the content of MAC_FILES:thread_mac.h (right separator?) in= to=20 the main sources. I have also renamed the entry-function and moved some s= tuff=20 around a bit ... . The main goal was to make the Mac-code symmetrical to = the=20 SDL-code, that is to give things with the same function the same name. threadID(): I presume that this is an integer value (eg "typedef unsigned= =20 ThreadID;" ). If not, all places where it is used as such will have to be= =20 modified. Anyway, I see no practical use for this thing except internally by class= =20 Thread. If it isn't adaptable we can as well remove it. WaitThread: This function waits until a thread has finished, on Mac it wi= ll=20 probably have to do something as while(running) YieldToAnyThread()//or YieldToThread(m_ID) ? I have NOT commited these changes, instead they are attached to this mail= =2E If=20 you=B4re also working on the threads this might be the better way. Test t= hem,=20 modify them and commit the changes.=20 I also didn=B4t look at the LoopThread code too much, considering that i= t=20 turned out that class Thread has to be started explicitly, I think it mig= ht=20 be useful to modify that class, too. Here too: the class isn=B4t used (I = think)=20 and can be painlessly removed. If we later find we need it, it is all sec= ured=20 in cvs. uli=00 |