Go to the source code of this file.
Data Structures | |
struct | ume_sem_t_stct |
struct | ume_block_src_t_stct |
Structure used to designate an UME Block source. More... | |
Defines | |
#define | SLEEP_SEC(x) sleep(x) |
#define | SLEEP_MSEC(x) |
#define | UME_BLOCK_DEBUG 0 |
#define | UME_BLOCK_DEBUG_PRINT(t,...) |
#define | UME_BLOCK_PRINT_ERROR(t,...) |
#define | UME_BLOCKING_TYPE "Posix pthread_cond" |
#define | UME_SEM_INIT(sem, len, ret) |
#define | UME_SEM_POST(sem) |
#define | UME_SEM_WAIT(sem) |
#define | UME_SEM_GETVALUE(sem, value) value = sem.state |
#define | UME_SEM_DESTROY(sem) |
#define | UME_SEM_TIMEDWAIT(sem, mstime, ret) |
#define | UME_SEM_TIMEDOUT(v) 0 |
#define | UME_SEM_TIMEDOK(v) 0 |
#define | UME_TIMESPEC_MSSET(t, s, n) 0 |
#define | UME_MALLOC_RETURN(e, s, r) |
#define | UME_TIME_OUT 5000 |
#define | UME_RETRY_COUNT 10 |
Typedefs | |
typedef ume_sem_t_stct | ume_sem_t |
typedef ume_block_bitmap_t_stct | ume_block_bitmap_t |
typedef ume_block_src_t_stct | ume_block_src_t |
Structure used to designate an UME Block source. | |
Functions | |
int | ume_block_src_delete (ume_block_src_t *asrc) |
Delete an UMEBlock Source object. | |
int | ume_block_src_create (ume_block_src_t **srcp, lbm_context_t *ctx, lbm_topic_t *topic, lbm_src_topic_attr_t *tattr, lbm_src_cb_proc proc, void *clientd, lbm_event_queue_t *evq) |
Create an UMEBlock Source that will send messages to a given topic. | |
int | ume_block_src_send_ex (ume_block_src_t *asrc, const char *msg, size_t len, int flags, lbm_src_send_ex_info_t *info) |
Extended send of a message to the topic associated with an UMBlock source. |
#define SLEEP_MSEC | ( | x | ) |
Value:
do{ \ if ((x) >= 1000){ \ sleep((x) / 1000); \ usleep((x) % 1000 * 1000); \ } \ else{ \ usleep((x)*1000); \ } \ }while (0)
#define UME_BLOCK_DEBUG_PRINT | ( | t, | |||
... | ) |
Value:
do { \ if(UME_BLOCK_DEBUG) { \ fprintf(stderr, t, ##__VA_ARGS__); \ fprintf(stderr, "\n"); \ } \ } while(0)
#define UME_BLOCK_PRINT_ERROR | ( | t, | |||
... | ) |
Value:
do { \ fprintf(stderr, t, ##__VA_ARGS__); \ fprintf(stderr, "\n"); \ } while(0)
#define UME_MALLOC_RETURN | ( | e, | |||
s, | |||||
r | ) |
Value:
do { \ if((e = malloc(s)) == NULL) { \ return r; \ } \ } while(0)
#define UME_SEM_DESTROY | ( | sem | ) |
Value:
do { \ pthread_cond_destroy(&(sem.cond)); \ pthread_mutex_destroy(&(sem.mtx)); \ } while (0)
#define UME_SEM_INIT | ( | sem, | |||
len, | |||||
ret | ) |
Value:
do { \ pthread_mutex_init(&(sem.mtx), NULL); \ pthread_cond_init(&(sem.cond), NULL); \ sem.max = len; \ sem.state = len; \ } while(0)
#define UME_SEM_POST | ( | sem | ) |
Value:
do { \ pthread_mutex_lock(&(sem.mtx)); \ if(sem.state < sem.max) { sem.state++; } \ pthread_cond_broadcast(&(sem.cond)); \ pthread_mutex_unlock(&(sem.mtx)); \ } while(0)
#define UME_SEM_TIMEDWAIT | ( | sem, | |||
mstime, | |||||
ret | ) |
Value:
do { \ struct timespec ts; \ gettimeofday((struct timeval*) &ts, NULL); \ ts.tv_sec += (mstime/1000); \ ts.tv_nsec = (ts.tv_nsec*1000) + ((mstime%1000)*1000000); \ pthread_mutex_lock(&(sem.mtx)); \ ret = pthread_cond_timedwait(&(sem.cond), &(sem.mtx), &ts); \ if(ret == 0) { sem.state--; } \ pthread_mutex_unlock(&(sem.mtx)); \ } while (0)
#define UME_SEM_WAIT | ( | sem | ) |
Value:
do { \ pthread_mutex_lock(&(sem.mtx)); \ while(sem.state == 0) { \ pthread_cond_wait(&(sem.cond), &(sem.mtx)); } \ sem.state--; \ pthread_mutex_unlock(&(sem.mtx)); \ } while(0)
int ume_block_src_create | ( | ume_block_src_t ** | srcp, | |
lbm_context_t * | ctx, | |||
lbm_topic_t * | topic, | |||
lbm_src_topic_attr_t * | tattr, | |||
lbm_src_cb_proc | proc, | |||
void * | clientd, | |||
lbm_event_queue_t * | evq | |||
) |
srcp | A pointer to a pointer to a UMEBlock source object. Will be filled in by this function to point to a newly created ume_block_src_t object. | |
ctx | Pointer to the LBM context object associated with the sender. | |
topic | Pointer to the LBM topic object associated with the destination of messages sent by the source. | |
tattr | Pointer to an LBM topic attribute object. The passed object CANNOT be NULL. | |
proc | Pointer to a function to call when events occur related to the source. If NULL, then events are not delivered to the source. | |
clientd | Pointer to tclient data that is passed when proc is called. | |
evq | Optional Event Queue to place events on when they occur. If NULL causes proc to be called from context thread. |
int ume_block_src_delete | ( | ume_block_src_t * | asrc | ) |
asrc | Pointero to an UMEBlock Source object to delete. |
int ume_block_src_send_ex | ( | ume_block_src_t * | asrc, | |
const char * | msg, | |||
size_t | len, | |||
int | flags, | |||
lbm_src_send_ex_info_t * | info | |||
) |
asrc | Pointer to the UMBlock source to send from. | |
msg | Pointer to the data to send in this message. | |
len | Length (in bytes) of the data to send in this message. | |
info | Pointer to lbm_src_send_ex_info_t options. |