Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1929 (closed defect: fixed)

Opened 14 years ago

Last modified 14 years ago

[PATCH] POSIX monitor attribute not being used

Reported by: llucax Assigned to: community
Priority: critical Milestone: 1.0
Component: Tango Version: 0.99.9 Kai
Keywords: Cc: luca@llucax.com.ar

Description

In dmd/monitor.c (and probably other compiler runtime too), the POSIX version of _STI_monitor_staticctor() is creating a pthread_mutexattr_t but when init()ializing the actual mutex, the attribute is not passed.

diff --git a/tango/core/rt/compiler/dmd/monitor.c b/tango/core/rt/compiler/dmd/monitor.c
index 66ee482..6e779a1 100644
--- a/tango/core/rt/compiler/dmd/monitor.c
+++ b/tango/core/rt/compiler/dmd/monitor.c
@@ -144,7 +144,7 @@ void _STI_monitor_staticctor()
     {
         pthread_mutexattr_init(&_monitors_attr);
         pthread_mutexattr_settype(&_monitors_attr, PTHREAD_MUTEX_RECURSIVE);
-        pthread_mutex_init(&_monitor_critsec, 0);
+        pthread_mutex_init(&_monitor_critsec, &_monitors_attr);
         inited = 1;
     }
 }

Change History

06/19/10 21:22:31 changed by mwarning

06/19/10 22:29:40 changed by mwarning

06/19/10 22:47:31 changed by llucax

Here is a more updated link to the specs (I don't know if there are any differences though): http://www.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html

07/06/10 21:00:09 changed by mwarning

  • status changed from new to closed.
  • resolution set to fixed.

(In [5494]) fixes #1929 :: POSIX monitor attribute not being used; thanks llucax, sean