RE: Do PTHREAD_PROCESS_SHARED mutexes/condvars w ork?
Chris McFarlen <[email protected]>
| Newsgroups | gmane.linux.ngpt.devel |
|---|---|
| Message-ID | <2980AA0FAAAE6B4DB3E9126F4451E740025C0077@dalxch02.dal.t-netix.com> |
Well, I get to respond to my own question, but you guys can tell me if this
is right. This patch fixes the problem:
diff -Eu -x '*\.o' ngpt-2.0.4/pth_sync.c ngpt-2.0.4-my/pth_sync.c
--- ngpt-2.0.4/pth_sync.c 2002-11-19 12:03:54.000000000 -0600
+++ ngpt-2.0.4-my/pth_sync.c 2002-12-27 14:55:36.000000000 -0600
@@ -408,7 +408,9 @@
wait:
/* already locked by caller? */
- if (mutex->mx_owner == current && mutex->mx_count >= 1) {
+ if (mutex->mx_owner == current &&
+ mutex->mx_owner_pid == descr->pid &&
+ mutex->mx_count >= 1) {
if (mutex->mx_type == PTH_MUTEX_RECURSIVE_NP) {
/* recursive lock */
mutex->mx_count++;
Chris McFarlen
T-NETIX, Inc.
-----Original Message-----
From: Chris McFarlen
Sent: Friday, December 27, 2002 2:58 PM
To: '[email protected]'
Subject: [pthreads-devel] Do PTHREAD_PROCESS_SHARED mutexes/condvars work?
I need to do some process syncronization, but the PTHREAD_PROCESS_SHARED
attribute does not seem to work. I am using NGPT 2.0.4, and I have tried a
stock 2.4.19 with the futex patch, and a 2.5.43 development kernel. Both
kernel versions have the same results. I have some test code that yields
the error, and I have made one modification to test_str03.c that also shows
the error.
The error comes from pthread_mutex_lock() when the mutex is locked by
another process (the mutex data is shared via shared memory, and initialized
with an attribute that has PTHREAD_PROCESS_SHARED set). The error is
EDEADLK.
I can post the test code I have and the change to get test_str03 to fail, if
there is interest in helping out. But I wanted to make sure that NGPT tries
to support PTHREAD_PROCESS_SHARED before I posted all of that. The
documentation seems to say that NGPT does and does not support
PTHREAD_PROCESS_SHARED in different places(there is a test for the case,
test_str03, but you have to supply a -s parameter, and then that really
doesn't work anyway...).
Thanks,
Chris McFarlen
T-NETIX, Inc.