event.h
Go to the documentation of this file.
1 
11 #ifndef EDAX_EVENT_H
12 #define EDAX_EVENT_H
13 
14 #include <stdbool.h>
15 #include "util.h"
16 
18 typedef struct Event {
19  volatile bool loop;
20  char **ring;
21  int size;
22  int first;
23  int end;
24  Thread thread;
25  SpinLock spin;
26  Lock lock;
27  Condition cond;
28 } Event;
30 void event_init(Event*);
31 void event_free(Event*);
33 void event_add_message(Event*, char*);
35 bool event_exist(Event*);
36 void event_wait(Event*, char**, char**);
37 void event_wait_enter(Event*);
38 
39 #endif /* EDAX_EVENT_H */
40 
void event_wait(Event *, char **, char **)
Wait input.
Definition: event.c:133
char * event_peek_message(Event *)
Peek the first message from the list.
Definition: event.c:187
int size
Definition: event.h:21
Condition cond
Definition: event.h:27
struct Event Event
Definition: event.h:18
Thread thread
Definition: event.h:24
void event_free(Event *)
Free a message event.
Definition: event.c:67
volatile bool loop
Definition: event.h:19
bool event_exist(Event *)
Check if there is a message.
Definition: event.c:176
void event_wait_enter(Event *)
Definition: event.c:156
void event_clear_messages(Event *)
Remove all unprocessed messages.
Definition: event.c:45
SpinLock spin
Definition: event.h:25
Miscellaneous utilities header.
int first
Definition: event.h:22
void event_init(Event *)
Initialize a message event.
Definition: event.c:23
char ** ring
Definition: event.h:20
void event_add_message(Event *, char *)
Add a new message at the bottom of the list.
Definition: event.c:93
Lock lock
Definition: event.h:26
int end
Definition: event.h:23