Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: "David Schwartz" <davids@xxxxxxxxxxxxx>
- Date: Tue, 19 Apr 2005 16:44:29 -0700
"um" <dont_email@xxxxxxxxxx> wrote in message
news:e47hxPORFHA.3628@xxxxxxxxxxxxxxxxxxxxxxx
> "David Schwartz" wrote
>>
>> "um" wrote
>>
>> > if ( result == -1 )
>> > {
>> > perror("thread: sem_trywait 1: expected error"); // No error
>> > assert(errno == EAGAIN);
>> >
>> > It is the last assert which fails in the first of the failing test
>> > programs.
>>
>> Why should 'perror' be expected to cause an 'EGAIN' error? You need
>> to
>> test 'errno' before calling any library functions that might change its
>> value. This code is broken.
>
> The code is not broken.
It is.
> In your quote you have left out the
> relevant part of the code.
> It is not perror which sets errno (funny imagination, btw).
How do you know that?
> errno is set by sem_trywait(). The code is:
yes, it's set by 'sem_trywait', but then the code calls 'perror' before
checking it!
> assert((result = sem_trywait(&s)) == -1);
> if ( result == -1 )
> {
> perror("thread: sem_trywait 1: expected error"); // No error
> assert(errno == EAGAIN);
Again, why would you expect 'perror' to set errno to 'EAGAIN'? Do you
have some documentation that says 'perror' is guaranteed not to change
errno?
DS
.
- Follow-Ups:
- References:
- VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: Carl Daniel [VC++ MVP]
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: David Schwartz
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- VC++ 2005 beta1 fails with pthreads benchmark tests
- Prev by Date: Re: VC++2003 Bug: Pointer-to-member type template arguments instantiated with virtual methods always call through first vtable slot
- Next by Date: Re: VC++2003 Bug: Pointer-to-member type template arguments instantiated with virtual methods always call through first vtable slot
- Previous by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Next by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Index(es):
Relevant Pages
|