OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Typedefs | Functions
opal_ring_buffer.h File Reference
`#include "opal_config.h"`
`#include "opal/threads/threads.h"`
`#include "opal/class/opal_object.h"`
`#include "opal/util/output.h"`

Go to the source code of this file.

## Data Structures
struct | opal_ring_buffer_t
| dynamic pointer ring More...

## Typedefs
typedef struct opal_ring_buffer_t | opal_ring_buffer_t
| Convenience typedef.

## Functions
OPAL_DECLSPEC | OBJ_CLASS_DECLARATION (opal_ring_buffer_t)
| Class declaration.
OPAL_DECLSPEC int | opal_ring_buffer_init (opal_ring_buffer_t *ring, int size)
| Initialize the ring buffer, defining its size. More...
OPAL_DECLSPEC void * | opal_ring_buffer_push (opal_ring_buffer_t *ring, void *ptr)
| Push an item onto the ring buffer. More...
OPAL_DECLSPEC void * | opal_ring_buffer_pop (opal_ring_buffer_t *ring)
| Pop an item off of the ring. More...
OPAL_DECLSPEC void * | opal_ring_buffer_poke (opal_ring_buffer_t *ring, int i)

## Function Documentation

OPAL_DECLSPEC int opal_ring_buffer_init | ( | opal_ring_buffer_t * | ring,
|  | int | size
| ) |  |

Initialize the ring buffer, defining its size.

Parameters

  ring | Pointer to a ring buffer (IN/OUT)
  size | The number of elements in the ring (IN)

Returns
  OPAL_SUCCESS if all initializations were succesful. Otherwise, the error indicate what went wrong in the function.

Initialize the ring buffer, defining its size.

References opal_ring_buffer_t::addr, opal_ring_buffer_t::size, and opal_pointer_array_t::size.

OPAL_DECLSPEC void* opal_ring_buffer_pop | ( | opal_ring_buffer_t * | ring | ) |

Pop an item off of the ring.

The oldest entry on the ring will be returned. If nothing on the ring, NULL is returned.

Parameters

  ring | Pointer to ring (IN)

Returns
  Error code. NULL indicates an error.

References opal_ring_buffer_t::addr, opal_ring_buffer_t::lock, and opal_ring_buffer_t::size.

OPAL_DECLSPEC void* opal_ring_buffer_push | ( | opal_ring_buffer_t * | ring,
|  | void * | ptr
| ) |  |

Push an item onto the ring buffer.

Parameters

  ring | Pointer to ring (IN)
  ptr | Pointer value (IN)

Returns
  OPAL_SUCCESS. Returns error if ring cannot take another entry

References opal_ring_buffer_t::addr, opal_ring_buffer_t::lock, and opal_ring_buffer_t::size.