Re: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-09 Thread Peter Rehley


On Jun 9, 2005, at 8:57 AM, Christopher Faylor wrote:


On Wed, Jun 08, 2005 at 03:29:46PM -0700, Peter Rehley wrote:

On Jun 8, 2005, at 2:59 PM, Thomas E. Zerucha wrote:


I have a problem similar to that of:

http://sourceware.org/ml/cygwin/2005-05/msg01400.html

I have an old system that I'm trying to port that uses pthreads, but
doesn't set the attribute, and a non-owner thread will destroy the
thread in a deallocate routine, but this won't happen (it won't
actually destroy the thread).

The problem is that (in pthread.h) PTHREAD_MUTEX_DEFAULT is .._NORMAL
on linux, the system was originally written for.  It works but
eventually dies when it runs out of threads or mutexes or something
since it can't recycle.  PTHREAD_MUTEX_DEFAULT is .._ERRORCHECK on
cygwin.

It would be painful to add a whole section to create an attribute
structure just to set this to be the same as linux.


If you look at the test case you will see a line that says
mutex=PTHREAD_MUTEX_INITIALIZER;

This causes the program to use the default (ERRORCHECK) mutex.  To get
a normal mutex, you can use mutex=PTHREAD_NORMAL_MUTEX_INITIALIZER_NP;

However, in the test case when NORMAL is used, the mutex never gets
unlocked because the signal SIG_CHLD doesn't get to the parent.


FWIW, I've changed the default for PTHREAD_MUTEX_INITIALIZER to
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP in CVS.  Last night I also tried to
implement handling for interrupting mutexes based on Corinna's
explanation of what your patch did.


Shouldn't PTHREAD_MUTEX_DEFAULT be PTHREAD_MUTEX_NORMAL?


Both of these changes are in the current snapshot.
And the pthread_mutex_lock is still waiting forever...doesn't process 
the signal.  Looking at the code I think that the pthread_mutex::_lock 
function should be using the cancelable_wait routine in place of the 
WaitForSingleObject.





cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Enjoy,
Peter
---
A Møøse once bit my sister


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-09 Thread Christopher Faylor
On Thu, Jun 09, 2005 at 11:16:42AM -0400, Thomas E. Zerucha wrote:
>>From: Larry Hall [mailto:[EMAIL PROTECTED]
>>>I can't seem to build the cygwin1.dll ...
>
>>Sounds OK to me.  Try stripping it.
>
>Been there, tried that..
>
>>>[built from source] and it complained about something with the address).
>
>> Perhaps it's best if you just tell us what the actual error message was
>and when it happened.
>
>First, note I used setup to update to the "current" versions of
>everything, apparently 1.5.17-1 (reported by cygcheck, and the source
>tarball).  I also have to do rebaseall since I use KDE.
>
>OK, I did ./configure;make;make install...
>
>29716 [main] ?  4056 multiple_cygwin_problem: cygheap base magic number
>mismatch detected - 0x6182/0x0

This may be due to a problem with binutils-20050520-1 and cygwin.  The
CVS/snapshot version of cygwin has improvements to cygwin's cygheap
handling which work better with newer binutils.

See the "Snapshots" and "Source in CVS" links on the main cygwin page if
you want to try either of these two methods.  Note that I've already
made the change for PTHREAD_MUTEX_DEFAULT in the latest CVS and this
version of cygwin is available as a snapshot.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-09 Thread Christopher Faylor
On Wed, Jun 08, 2005 at 03:29:46PM -0700, Peter Rehley wrote:
>On Jun 8, 2005, at 2:59 PM, Thomas E. Zerucha wrote:
>
>>I have a problem similar to that of:
>>
>>http://sourceware.org/ml/cygwin/2005-05/msg01400.html
>>
>>I have an old system that I'm trying to port that uses pthreads, but
>>doesn't set the attribute, and a non-owner thread will destroy the
>>thread in a deallocate routine, but this won't happen (it won't
>>actually destroy the thread).
>>
>>The problem is that (in pthread.h) PTHREAD_MUTEX_DEFAULT is .._NORMAL
>>on linux, the system was originally written for.  It works but
>>eventually dies when it runs out of threads or mutexes or something
>>since it can't recycle.  PTHREAD_MUTEX_DEFAULT is .._ERRORCHECK on
>>cygwin.
>>
>>It would be painful to add a whole section to create an attribute
>>structure just to set this to be the same as linux.
>
>If you look at the test case you will see a line that says
>mutex=PTHREAD_MUTEX_INITIALIZER;
>
>This causes the program to use the default (ERRORCHECK) mutex.  To get
>a normal mutex, you can use mutex=PTHREAD_NORMAL_MUTEX_INITIALIZER_NP;
>
>However, in the test case when NORMAL is used, the mutex never gets
>unlocked because the signal SIG_CHLD doesn't get to the parent.

FWIW, I've changed the default for PTHREAD_MUTEX_INITIALIZER to
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP in CVS.  Last night I also tried to
implement handling for interrupting mutexes based on Corinna's
explanation of what your patch did.

Both of these changes are in the current snapshot.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-09 Thread Thomas E. Zerucha

>From:  Larry Hall [mailto:[EMAIL PROTECTED]

>>I can't seem to build the cygwin1.dll ...

>Sounds OK to me.  Try stripping it.

Been there, tried that..

>>[built from source] and it complained about something with the address).

> Perhaps it's best if you just tell us what the actual error message was
and when it happened.

First, note I used setup to update to the "current" versions of everything, 
apparently 1.5.17-1 (reported by cygcheck, and the source tarball).  I also 
have to do rebaseall since I use KDE.

OK, I did ./configure;make;make install...

  29716 [main] ? 4056 multiple_cygwin_problem: cygheap base magic number 
mismatch detected - 0x6182/0x0

If I try to rebase it, nothing works and I get a bigger error message.

If it is a rebase problem, is there any way to get the current address (from 
/bin/cygwin1.dll) so I can set the built one to it?

Even if I strip the newly made dll, it isn't the same size as the release 
version.  Are there instructions anywhere to build an exact copy of the release.

I need to change exactly one byte in trace.o(.cc) so PTHREAD_MUTEX_DEFAULT will 
be different to see if this fixes my problem.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-08 Thread Larry Hall
At 05:59 PM 6/8/2005, you wrote:
>I can't seem to build the cygwin1.dll so I could replace it (are there any 
>instructions on how to create an identical copy to the release?  I didn't see 
>any on the FAQ, and ./configure;make generates a file 8x larger, 


Sounds OK to me.  Try stripping it.


>and it complained about something with the address).


Yes, Cygwin doesn't like addresses.  It prefers locales of enumeration.
It's a subtle difference but very important to Cygwin.  We've tried for
years to make it switch to using addresses but it's just stubborn.  We've
tried everything.  Locking it in it's room.  Sending it to bed without any
supper.  Even boot camps.  Nothing worked.  At this point, we've just 
given up on it.

Perhaps it's best if you just tell us what the actual error message was
and when it happened.  We may not be good at curing Cygwin of it's stubborn
ways but after all these years, there are some people on this list that are
good at deciphering it's "moods".


--
Larry Hall  http://www.rfk.com
RFK Partners, Inc.  (508) 893-9779 - RFK Office
838 Washington Street   (508) 893-9889 - FAX
Holliston, MA 01746 


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-08 Thread Peter Rehley


On Jun 8, 2005, at 2:59 PM, Thomas E. Zerucha wrote:


I have a problem similar to that of:

http://sourceware.org/ml/cygwin/2005-05/msg01400.html

I have an old system that I'm trying to port that uses pthreads, but 
doesn't set the attribute, and a non-owner thread will destroy the 
thread in a deallocate routine, but this won't happen (it won't 
actually destroy the thread).


The problem is that (in pthread.h) PTHREAD_MUTEX_DEFAULT is .._NORMAL 
on linux, the system was originally written for.  It works but 
eventually dies when it runs out of threads or mutexes or something 
since it can't recycle.  PTHREAD_MUTEX_DEFAULT is .._ERRORCHECK on 
cygwin.


It would be painful to add a whole section to create an attribute 
structure just to set this to be the same as linux.

If you look at the test case you will see a line that says
mutex=PTHREAD_MUTEX_INITIALIZER;

This causes the program to use the default (ERRORCHECK) mutex.  To get 
a normal mutex, you can use

mutex=PTHREAD_NORMAL_MUTEX_INITIALIZER_NP;

However, in the test case when NORMAL is used, the mutex never gets 
unlocked because the signal SIG_CHLD doesn't get to the parent.


Hopefully that is something that you can use.


I can't seem to build the cygwin1.dll so I could replace it (are there 
any instructions on how to create an identical copy to the release?  I 
didn't see any on the FAQ, and ./configure;make generates a file 8x 
larger, and it complained about something with the address).


You need to provide more information than this.  Based on what you 
said, you didn't follow the instructions in the FAQ; and yes there are 
instructions for building the cygwin1.dll in the FAQ



I think just changing it in the pthread.h and recompiling the dll will 
fix it.  Note that the attribute is invisible since you need not 
bother with the attr structure and parameter when doing defaults.



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Enjoy,
Peter
---
A Møøse once bit my sister


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

2005-06-08 Thread Thomas E. Zerucha
I have a problem similar to that of:

http://sourceware.org/ml/cygwin/2005-05/msg01400.html

I have an old system that I'm trying to port that uses pthreads, but doesn't 
set the attribute, and a non-owner thread will destroy the thread in a 
deallocate routine, but this won't happen (it won't actually destroy the 
thread).

The problem is that (in pthread.h) PTHREAD_MUTEX_DEFAULT is .._NORMAL on linux, 
the system was originally written for.  It works but eventually dies when it 
runs out of threads or mutexes or something since it can't recycle.  
PTHREAD_MUTEX_DEFAULT is .._ERRORCHECK on cygwin.

It would be painful to add a whole section to create an attribute structure 
just to set this to be the same as linux.

I can't seem to build the cygwin1.dll so I could replace it (are there any 
instructions on how to create an identical copy to the release?  I didn't see 
any on the FAQ, and ./configure;make generates a file 8x larger, and it 
complained about something with the address).

I think just changing it in the pthread.h and recompiling the dll will fix it.  
Note that the attribute is invisible since you need not bother with the attr 
structure and parameter when doing defaults.


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/