counting semaphore question

Scott J scott.j at myrealbox.com
Sat Dec 21 10:37:51 UTC 2002


Hi, all
	When I using couning semaphore I'v some question not so clear. Could anyone give some advice? In application if I creat a counting semaphore and obtain it many times more than it's initial value, will its counting value decrease to be negative ? For example, if:

	/* initial value: 1 */	
	rtems_semaphore_create( name, 1, RTEMS_DEFAULT_ATTRIBUTES, 1, &id );

	/* decrease to 0 ?  */
	rtems_semaphore_obtain( id, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); 

	/* decrease to -1 ? */
    rtems_semaphore_obtain( id, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); 

	Will the semaphore count be -1? Is there a return value or anything else to notify user that the semaphore count has come to its limitation?

	TIA.

----
Scott
Dec 21, 2002





More information about the users mailing list