POSIX Semaphores Problems

rtwas rtwas at comcast.net
Thu Jan 28 00:04:38 UTC 2010


-rtems4.9.3
-mvme5500
-configure: configure --target=powerpc-rtems4.9 
--enable-rtemsbsp=mvme5500 --enable-networking --enable-posix

Hello,

I'm writing an app using RTEMS POSIX threads, and semaphores. I have one 
thread doing a "sem_post()"
on a semaphore that's being watched in another thread using 
"sem_wait()". The semaphore originates
in a struct in the second thread's "c" file (call it thrd1.c). That 
pointer is passed to the thrd0's context
using a function (call it struct thrd1_s * thrd1_cdp()). This setup 
works great on linux on an intel box. But
when I run it under RTEMS, the first pass in the loop looks fine but the 
2nd-N passes give errors (return -1) on both
calls to "sem_post()" and "sem_wait()". "perror()" prints: "Invalid 
argument" on both calls as well. The "sem_wait()"
returns immediately (does not block).

I thought I might have been clobbering the struct somehow so I printed 
the pointers and the value of the sem variable.
Neither change from their *init'd* values. In main I config the max 
POSIX thread count to 20 (I'm only using 1).

Help and ideas appreciated.

Thanks.

Robert W.





More information about the users mailing list