Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 2 and Version 3 of DevelFAQ

Show
Ignore:
Author:
llucax (IP: 190.226.94.58)
Timestamp:
12/06/08 13:51:16 (15 years ago)
Comment:

Add question about thread_needLock()

Legend:

Unmodified
Added
Removed
Modified
  • DevelFAQ

    v2 v3  
    99  Each portion of the runtime is designed to be built as a standalone entity--ie. without importing any headers other than OS or standard C headers.  One reason for this is so that a GC, for example, could be created without any implementation-level dependencies on core, so if the core implementation changes the GC doesn't need to be rebuilt (which would be necessary if the -inline flag were set, for example). In the long run, the DRuntime project should not exist at all.  Instead, compiler developers should develop their own compiler runtime according to the spec, GC developers a GC according to the spec, etc. 
    1010 
     11 3. Why thread_needLock() returns true when the program has ever been multithreaded at any point in its execution and whether more than 1 thread is currently running? 
     12 
     13  Typically, the stores of a terminating thread are only guaranteed to be visible when join() returns for that thread... and then to the joining thread only. While it's true that the stores will eventually be visible to all threads in a program, there's no easy way to figure out exactly when this is (the lock-free people would probably say you'd have to wait for a "quiescent state").  I also don't know of any apps that are multi threaded for a while and then later become single threaded, so the issue of performance loss seems like somewhat of a corner case.