[Issue 14617] New: PTHREAD_MUTEX_INITIALIZER does not work on OSX

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 22 12:06:24 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14617

          Issue ID: 14617
           Summary: PTHREAD_MUTEX_INITIALIZER does not work on OSX
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Initializing a mutex with PTHREAD_MUTEX_INITIALIZER puts it in an all-zero
state:

pthread_mutex_t(0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

This state is unsuitable for calls such as pthread_mutex_lock etc. The state
after calling the dynamic initialization routine pthread_mutex_init is:

pthread_mutex_t(1297437784, [0, 0, 0, 0, 96, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

How do we define this state using the available pthread/OSX constants?

--


More information about the Digitalmars-d-bugs mailing list