|
From: Alexander P. <gl...@go...> - 2009-07-23 11:22:53
|
By the way, pth_inconsistent_cond_wait.c uses sem_init() as well, so it's incorrect to run it on Darwin. However, replacing sem_init with the appropriate sem_open call does not help to fix pthread_cond_timedwait() On Thu, Jul 23, 2009 at 3:12 PM, Alexander Potapenko<gl...@go...> wrote: > I've tried the tests on Mac OS 10.5 (Darwin Kernel Version 9.7.0: Tue > Mar 31 22:52:17 PDT 2009) > Here are the results > > glider$ ./pth_inconsistent_cond_wait > pth_inconsistent_cond_wait.c:52 pthread_cond_timedwait(&s_cond, mutex, > &deadline) returned error code 22 (Invalid argument) > > this is a bit confusing. > > glider$ ./tc17_sembar > starting > done, result is 99, should be 88 > > this is expected, because sem_init is not implemented on Darwin, only > named semaphores are supported. > > On Thu, Jul 23, 2009 at 12:06 PM, Bart Van > Assche<bar...@gm...> wrote: >> Hello, >> >> While trying to port DRD to Darwin I noticed that on the Mac OS X system I >> used several POSIX threads functions behave differently than their Linux >> equivalents. Please note that the results below have been obtained on an old >> system (kernel 9.2.0). It would be great if someone could confirm whether >> the results below can be reproduced on a Mac OS X system with the latest >> updates installed. Note: the results below have been obtained by running >> native executables and hence are not related to the behavior of any Valgrind >> tool. >> >> * drd/tests/pth_inconsistent_cond_wait >> >> Linux: >> >> $ drd/tests/pth_inconsistent_cond_wait >> (empty output, as expected) >> >> Darwin: >> >> $ drd/tests/pth_inconsistent_cond_wait >> drd/tests/pth_inconsistent_cond_wait >> pth_inconsistent_cond_wait.c:52 pthread_cond_timedwait(&s_cond, mutex, >> &deadline) returned error code 22 (Invalid argument) >> pth_inconsistent_cond_wait.c:52 pthread_cond_timedwait(&s_cond, mutex, >> &deadline) returned error code 60 (Operation timed out) >> >> It is not clear to me why the first call to pthread_cond_timedwait() returns >> EINVAL on Darwin. As far as I know EINVAL means that either the condition >> variable, mutex or timeout passed to pthread_cond_timedwait() is invalid ? >> See also >> http://www.opengroup.org/onlinepubs/000095399/functions/pthread_cond_timedwait.html. >> >> >> * helgrind/tests/tc17_sembar >> >> Linux: >> $ helgrind/tests/tc17_sembar >> starting >> done, result is 88, should be 88 >> (expected output) >> >> Darwin: >> $ helgrind/tests/tc17_sembar >> starting >> done, result is 99, should be 88 >> (not expected) >> >> I've also noticed that DRD reports race conditions in the >> drd/tests/circular_buffer test program on Darwin but not on Linux. Both the >> tc17_sembar and the circular_buffer test program trigger many semaphore >> calls. >> >> Bart. >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> Valgrind-developers mailing list >> Val...@li... >> https://lists.sourceforge.net/lists/listinfo/valgrind-developers >> >> > > > > -- > WBR, > Alexander Potapenko > Software Engineer > Google Moscow > -- WBR, Alexander Potapenko Software Engineer Google Moscow |