#ifndef MR_EVENT_H
#define MR_EVENT_H

#include <pthread.h>

typedef struct mrevent {
    pthread_mutex_t mutex;
    pthread_cond_t cond;
    int triggered;
} mrevent;

void mrevent_init(struct mrevent *ev, int nSignalled);
void mrevent_trigger(struct mrevent *ev);
void mrevent_trigger_code(struct mrevent *ev, int nCode);
void mrevent_reset(struct mrevent *ev);
int mrevent_wait(struct mrevent *ev);
int mrevent_timedwait(struct mrevent *ev, int nMilliseconds);
void mrevent_close(struct mrevent *ev);

#endif
