View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003114 | Spring engine | Mac OS X | public | 2012-06-13 05:59 | 2013-04-08 02:35 |
| Reporter | foxtrot | Assigned To | zerver | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Product Version | 89.0 | ||||
| Summary | 0003114: I got multhreaded starting on OSX using pthread_getspecific() for TLS | ||||
| Description | MT on mac was bugged because its TLS directly manipulates the FS/GS registers, speedy-tls uses linux-specific code to map memory, and xcode doesn't support gcc's __thread. So, inside gmlcls.h, I changed thread-local storage from the assembly method into a pthread_getspecific() method. Since the only TLS is a single thread number integer, it's not that complicated. I simply replace get_threadnum with pthread getspecific() versions. getspecific() is very fast on darwin, so FS/GS hackery is not needed. When playing, I can't see any widgets, lua crashes all the time, but at least spring-multithreaded starts I can click my commander and make him walk around... my working code in gmlcls.h (hope this helps!): # ifdef __APPLE__ // hackitude: #undef set_threadnum #undef get_threadnum // we forgo all the segment register manipulation since pthread_setspecific is pretty fast on darwin. #include <pthread.h> // this class is instantiated statically so that keys are initialized exactly once per app run. class CPthreadKeys { public: pthread_key_t threadnum_key; CPthreadKeys(){ pthread_key_create(&threadnum_key, NULL); } }; static CPthreadKeys pthreadkeys; inline int get_threadnum(void){ return (int)(long) pthread_getspecific(pthreadkeys.threadnum_key); } inline void set_threadnum(int ThreadNumber){ pthread_setspecific(pthreadkeys.threadnum_key, (void*) ThreadNumber); } #define gmlThreadNumber get_threadnum() #else // NON APPLE GML STUFF (aka the rest of it) goes here #endif | ||||
| Additional Information | osx 10.6, 32-bit kernel, 64 bit spring compile | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Checked infolog.txt for Errors | |||||
|
|
The speedy-tls docs here http://www.kevinjhoffman.com/speedy-tls/ says it has been tested with OSX x86 (10.4, GCC 4.0.1) Can you please check if the file I attached works any better? It is speedy-tls version 1.0, and I noticed the one in the spring repo had some slight differences. |
|
|
no feedback for a long time, and other users reported ASIM running on OSX without the suggested changes |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-06-13 05:59 | foxtrot | New Issue | |
| 2012-06-16 21:37 | zerver | Status | new => assigned |
| 2012-06-16 21:37 | zerver | Assigned To | => zerver |
| 2012-06-17 17:08 | zerver | File Added: speedy-tls.cpp | |
| 2012-06-17 17:09 | zerver | Note Added: 0008794 | |
| 2012-06-17 17:09 | zerver | Status | assigned => feedback |
| 2013-04-08 02:35 | zerver | Note Added: 0010407 | |
| 2013-04-08 02:35 | zerver | Status | feedback => closed |
| 2013-04-08 02:35 | zerver | Resolution | open => no change required |