My Project
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
18typedef 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;
30void event_init(Event*);
31void event_free(Event*);
33void event_add_message(Event*, char*);
35bool event_exist(Event*);
36void event_wait(Event*, char**, char**);
38
39#endif /* EDAX_EVENT_H */
40
void event_add_message(Event *, char *)
Add a new message at the bottom of the list.
Definition: event.c:93
void event_free(Event *)
Free a message event.
Definition: event.c:67
void event_wait_enter(Event *)
Definition: event.c:156
void event_init(Event *)
Initialize a message event.
Definition: event.c:23
void event_clear_messages(Event *)
Remove all unprocessed messages.
Definition: event.c:45
char * event_peek_message(Event *)
Peek the first message from the list.
Definition: event.c:187
void event_wait(Event *, char **, char **)
Wait input.
Definition: event.c:133
bool event_exist(Event *)
Check if there is a message.
Definition: event.c:176
Definition: event.h:18
Condition cond
Definition: event.h:27
int size
Definition: event.h:21
Lock lock
Definition: event.h:26
char ** ring
Definition: event.h:20
int first
Definition: event.h:22
Thread thread
Definition: event.h:24
SpinLock spin
Definition: event.h:25
int end
Definition: event.h:23
volatile bool loop
Definition: event.h:19
Miscellaneous utilities header.