Re: errno global vx. errno pthread...
Re: errno global vx. errno pthread...
- Subject: Re: errno global vx. errno pthread...
- From: Patrick Rutkowski <email@hidden>
- Date: Fri, 3 Oct 2008 19:40:32 -0400
Using the symbol "errno" is the right thing to do in all cases,
threaded or non-threaded.
This is why it's usually implemented as a macro, so that under the
hood it's really a call
to some OS specific function get the thread's local errno, e.g.:
./sys/errno.h:#define errno (*__error())
You're asking "how to distinguish errno (global) from errno ( thread
local) on OS X 10.5 Leopard?",
but I don't think that question even makes any sense; there's no such
thing as a global errno, as far
as I can tell.
-Patrick
On Oct 3, 2008, at 6:56 PM, Michael Andronov wrote:
Hi,
I am presently debugging an application, which has 2 threads:
1. First thread - TH1 - is waiting to be waked up within the
function sem_wait(...)
2. Second thread - TH2 - is executing some code. Within such code,
there is a call for fsync(...) function.
The behavior is that if fsync() function within TH2 is failing,
then TH1 is returning form sem_wait(...) with errno EBADF ( int 9).
The only explanation I see is that for some reason global errno is
checked within TH1 instead of thread local.
The code , in C++, is compiled with `-pthread` flag, under OS X
10.5...
My question is how to distinguish errno (global) from errno ( thread
local) on OS X 10.5 Leopard?
Thanks for kind attention to this matter.
Michael.
P.S> I have seen same posting about similar issue dated 2002, but
the `fixes` seems not working on 10.5...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden