DS 7 - Semaphores
 All Data Structures Files Functions Variables Macros Pages
arg_t Struct Reference

Thread specific informations for consumer and producer threads. More...

Data Fields

char * buf
 The shared buffer.
int buf_size
 holds the size of the shared ring buffer
sem_t * open_sem
 This semaphore holds the number of free locations.
sem_t * ready_sem
 This semaphore holds the number of ready locations.

Detailed Description

Thread specific informations for consumer and producer threads.

This structure is used to instruct the thread about where is the shared buffer and the semaphore to use.

Field Documentation

arg_t::buf

The shared buffer.

Producers will fill locations in this buffer, while consumers will read and print the bytes in the buffer.

arg_t::buf_size

holds the size of the shared ring buffer

This variable stores the size of the shared ring buffer

arg_t::open_sem

This semaphore holds the number of free locations.

This semaphore is used by the producer to produce a new byte in the shared buffer. It will be used by the consumer to notify that a byte has been consumed from the buffer.

arg_t::ready_sem

This semaphore holds the number of ready locations.

This semaphore is used by the producer to notify that a new byte in the shared buffer has been produced. It will be used by the consumer to understand that a byte can be consumed from the buffer.


The documentation for this struct was generated from the following file: