Friedrich-Alexander-Universität UnivisSuche FAU-Logo
Techn. Fakultät Willkommen am Department Informatik FAU-Logo
Logo I4
Lehrstuhl für Informatik 4
SP
 
  Vorlesung
  Folien
  Übungen
  Evaluation
  Prüfungsinformationen
  Forum
  protected area Intern
Übungen
  Folien
  Aufgaben
Department Informatik  >  Informatik 4  >  Lehre  >  WS 2010/11  >  SP  >  Übung  >  Doku  >  multithreaded webserver: bbuffer.h File Reference

process list

bbuffer.h File Reference

Bounded Buffer implementation to manage int values that supports multiple readers but only a single writer. More...

Go to the source code of this file.

Typedefs

typedef struct BNDBUF BNDBUF

Functions

BNDBUFbb_init (unsigned int size)
 Creates a new Bounded Buffer.
void bb_del (BNDBUF *bb)
 Destroys a Bounded Buffer.
int bb_get (BNDBUF *bb)
 Retrieve an element from the bounded buffer.
void bb_add (BNDBUF *bb, int fd)
 Add an element to the bounded buffer.


Detailed Description

Bounded Buffer implementation to manage int values that supports multiple readers but only a single writer.

The bbuffer module uses the sem module API to synchronize concurrent access of readers and writers to the bounded buffer.


Typedef Documentation

typedef struct BNDBUF BNDBUF

Opaque type of a Bounded Buffer.


Function Documentation

void bb_add ( BNDBUF bb,
int  fd 
)

Add an element to the bounded buffer.

This function adds an element to the bounded buffer. If the bounded buffer is full, the function blocks until an element is removed from the buffer.

Parameters:
bb Handle of the bounded buffer.
fd Value that shall be added to the buffer.

void bb_del ( BNDBUF bb  ) 

Destroys a Bounded Buffer.

All resources associated with the bounded buffer are released.

Parameters:
bb Handle of the bounded buffer that shall be freed.

int bb_get ( BNDBUF bb  ) 

Retrieve an element from the bounded buffer.

This function removes an element from the bounded buffer. If the bounded buffer is empty, the function blocks until an element is added to the buffer.

Parameters:
bb Handle of the bounded buffer.
Returns:
the int element

BNDBUF* bb_init ( unsigned int  size  ) 

Creates a new Bounded Buffer.

This function creates a new bounded buffer and all the helper data structures required by the buffer, including semaphores for synchronization. If an error occurs during the initialization the implementation shall free all resources already allocated by then.

Parameters:
size The number of integers that can be stored in the bounded buffer.
Returns:
handle for the created bounded buffer, or NULL if an error occured.

  Impressum   Datenschutz Stand: 2011-01-24 10:23   MS