POSIX Semaphores Problems

Till Straumann strauman at slac.stanford.edu
Thu Jan 28 00:56:52 UTC 2010


Difficult to help w/o more info (source code).
I suspect a programming error that is triggered
by different timing under RTEMS compared to linux.

Is the semphore destroyed somehow?

T.

rtwas wrote:
> -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.
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users




More information about the users mailing list