| iMatix home page | << | < | > | >> |
SMT Version 2.81 |
#include "smtlib.h" EVENT * event_accept ( QUEUE *queue, /* Queue to take event from */ EVENT *event /* Event, or null for first */ )
Takes an event off an event queue, and sends an 'accept' reply to the original sender, if required. If the specified event is null, takes the first (oldest) event in the queue. Otherwise takes the specified event. Returns the address of the event. You should call event destroy() when you have finished processing the event. In case of error, returns NULL and sets smt_errno to one of these values:
SMT NOTREADY | smt_init() was not called, or failed |
SMT QUEUEISEMPTY | The queue was empty |
{ #if (defined (SMT_TRACE)) trace ("event_accept"); #endif ASSERT (queue); if (!smt_alive) /* If SMT API was not correctly */ { /* initialised, forget it */ smt_errno = SMT_NOTREADY; return (NULL); } if ((event = event_locate (queue, event)) == NULL) return (NULL); /* Reply to original sender if necessary */ if (event-> accept_event) event send ( &event-> sender, /* Send back to original sender */ NULL, /* No queue for reply */ event-> accept_event, /* Name of event to send */ NULL, 0, /* Body is empty, size is 0 */ NULL, NULL, NULL, /* No response events */ 0); /* No timeout */ if (event-> timeout) queue-> timed_events++; /* One less timed event, maybe */ queue-> cur_events--; /* One less event in queue */ node_unlink (event); /* Unlink from queue */ return (event); }
| << | < | > | >> | Copyright © 1996-99 iMatix Corporation |