My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Functions
local_msu.h File Reference

Declares the structures and functions applicable to MSUs on the local machine. More...

#include "msu_type.h"
#include "message_queue.h"
#include "worker_thread.h"

Go to the source code of this file.

Classes

struct  local_msu
 The structure that represents an MSU located on the local machine. More...
 

Functions

struct local_msuinit_msu (unsigned int id, struct msu_type *type, struct worker_thread *thread, struct msu_init_data *data)
 Allocates and creates a new MSU of the specified type and ID on the given thread. More...
 
int try_destroy_msu (struct local_msu *msu)
 Destroys the MSU, but only if it has no states currently saved. More...
 
void destroy_msu (struct local_msu *msu)
 Calls type-specific destroy function and frees associated memory. More...
 
int msu_dequeue (struct local_msu *msu)
 Dequeus a message from a local MSU and calls its receive function. More...
 
struct local_msuget_local_msu (unsigned int id)
 Gets the local MSU with the given ID, or NULL if N/A. More...
 
int msu_error (struct local_msu *msu, struct msu_msg_hdr *hdr, int broadcast)
 

Detailed Description

Declares the structures and functions applicable to MSUs on the local machine.

Definition in file local_msu.h.

Function Documentation

void destroy_msu ( struct local_msu msu)

Calls type-specific destroy function and frees associated memory.

Definition at line 257 of file local_msu.c.

struct local_msu* get_local_msu ( unsigned int  id)

Gets the local MSU with the given ID, or NULL if N/A.

Parameters
idID of the MSU to retrieve
Returns
local msu instance, or NULL on error

Definition at line 134 of file local_msu.c.

struct local_msu* init_msu ( unsigned int  id,
struct msu_type type,
struct worker_thread thread,
struct msu_init_data data 
)

Allocates and creates a new MSU of the specified type and ID on the given thread.

Parameters
idID of the MSU to be created
typeMSU type of the MSU to be created
threadThe thread on which this MSU is to be created
dataAny initial data that is passed to the MSU's specific init function
Returns
The created local MSU, or NULL on error

Definition at line 198 of file local_msu.c.

int msu_dequeue ( struct local_msu msu)

Dequeus a message from a local MSU and calls its receive function.

Parameters
msuMSU to dequeue the message from
Returns
0 on success, -1 on error, 1 if no message existed to be dequeued

Definition at line 323 of file local_msu.c.

int msu_error ( struct local_msu msu,
struct msu_msg_hdr hdr,
int  broadcast 
)

Definition at line 353 of file local_msu.c.

int try_destroy_msu ( struct local_msu msu)

Destroys the MSU, but only if it has no states currently saved.

Returns
0 on success, 1 if MSU cannot be destroyed

Definition at line 249 of file local_msu.c.