[beports] Re: POSIX functions

2008/8/31 Andreas Färber <andreas.faerber@xxxxxx>:
> I was confused by that as well, but B_BAD_VALUE and EINVAL seemed equivalent
> by value so that part is not wrong per se. I agree, it would be more
> readable though to use the POSIX error constants in POSIX functions.

Since cond_signal seems to be used only in the POSIX section, I think
it won't harm
to make it more readable as you said.

The attached patch should fix the problem.
Would you mind testing it out?

Regards,
-- 
Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa
www.haiku-os.it
Index: src/system/libroot/posix/pthread/pthread_cond.c
===================================================================
--- src/system/libroot/posix/pthread/pthread_cond.c     (revision 27249)
+++ src/system/libroot/posix/pthread/pthread_cond.c     (working copy)
@@ -121,10 +121,14 @@
 cond_signal(pthread_cond_t *cond, bool broadcast)
 {
        if (cond == NULL)
-               return B_BAD_VALUE;
+               return EINVAL;
 
        atomic_add((vint32*)&cond->event_counter, 1);
-       return release_sem_etc(cond->sem, broadcast ? cond->waiter_count : 1, 
0);
+       if (release_sem_etc(cond->sem, broadcast ? cond->waiter_count : 1, 0)
+               != B_OK)
+               return EINVAL;
+
+       return B_OK;
 }
 
 

Other related posts: