Title | Can't use threads on OS X. |
Status | closed |
Priority | essential |
Assigned user | David Lovemore |
Organization | Ravenbrook |
Description | Can't use threads on OS X. The thread interface needs implementing on OS X. So that clients can use threads. Thread interface is necessary to scan the stacks of other threads. Therefore need it when a client wishes to register the stack of more than one thread as a root. If the client wants to be multithreaded and call the MPS from different threads (which is an obviously related issue), then they need an MPS with locks. See job001622. |
Analysis | Since changelist 178926, thix.c may be a good starting point. RB 2012-08-15: I spent half an hour seeing if this was now trivial using thix.c. It appears not. In Mac OS X 10.8 (Mountain Lion), the ucontext routines are deprecated, and the machine state needed to get the stack pointer is somewhat tortuous. I have re-enrolled in the Mac OS X developer program in the hope of getting more information. The source code of Boehm may also be informative. The Boehm GC file darwin_stop_world.c [1] uses Mach thread_get_state. We could probably do with comparing all our code to Boehm's stop-world. RB 2013-06-16: Boehm now lives on GitHub < https://github.com/ivmai/bdwgc/blob/master/os_dep.c#L1175 >.RB 2013-06-16: I recently did some short term hacking on the MLWorks runtime and managed to dig up registers from the signal context. This is a different approach to Boehm but may work fine and be more similar to the code for other Unix platforms. RB 2013-06-18: Mac OS X registers appear to be available from signal contexts using paths like uc.uc_mcontext->__ss.__rip. It may be necessary to define _XOPEN_SOURCE before including "ucontext.h" to get the definitions. Branch prmci[36]li.c to prmci[36]xc.c and adapt. You will also probably need to check protsgix.c. |
How found | unknown |
Evidence | [1] <http://opensource.apple.com/source/gcc/gcc-5488/boehm-gc/darwin_stop_world.c >< https://info.ravenbrook.com/mail/2013/05/28/16-34-12/0/ > |
Observed in | 1.107.0 |
Created by | David Jones |
Created on | 2007-02-20 13:43:53 |
Last modified by | Richard Brooksby |
Last modified on | 2013-07-11 16:19:39 |
History | 2007-02-20 DRJ Created. 2012-08-15 RB Updated analysis. 2013-03-19 GDR Assigned to RB. 2013-06-16 RB Added notes on Boehm and MLWorks hacks. |
Change | Effect | Date | User | Description |
---|---|---|---|---|
183002 | closed | 2013-07-11 15:55:58 | Richard Brooksby | Merging branch/2013-06-18/macosx-threads back to master. |
182787 | open | 2013-06-18 11:39:49 | David Lovemore | Create branch for MacOS X threading. |