This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: Multiple Readers / Exclusive Writer implementation/API

Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Does the SysBios have any functionality that provides Read/Write Semaphores (or mutual exclusion), where there are multiple readers, but only one writer permitted ? 

Sample behavior

"

When a task takes a read/write semaphore in read mode, the behavior is different

from other semaphores. It does not provide exclusive access to a resource (does not

protect critical sections), and the semaphore may be concurrently held in read

mode by more than one task.

"

  • I'm not sure I'm getting the question. It sounds more like a broadcast. If that's the case, you could create a counting semaphore. Say there are N readers and 1 writer. The writer would post the semaphore N times to allow all the readers to unblock. Of course, there are some edge cases to worry about. For example what if one of the readers does not call pend? So the count would not go to zero (zero = not signaled).

    You could use an Event. Each reader would be assigned a bit in the Event. The writer would post an Event with N bits set (N = # of readers). Each reader would pend on it's unique bit in the mask. I like this approach more than the counting semaphore one since it avoids the case of a reader never pending.

    If these did not help, can you give a more concrete use case?

    Todd
  • Did this get resolved?

    [Update 6/28: I'm closing this due to lack of responses]