#ifndef SWIFT_THREAD_COND_H
#define SWIFT_THREAD_COND_H

#include <swift/atomic.h>
#include <swift/stdlib.h>
#include <swift/time.h>

#include <swift/thread/api.h>
#include <swift/thread/mutex.h>

typedef struct swift_cond_t swift_cond_t;

struct swift_cond_t {
	swift_ref_t ref;
	void *data;
	bool on_heap;
};

SWIFT_THREAD_API bool swift_init_cond(swift_cond_t *cond);
SWIFT_THREAD_API void swift_term_cond(swift_cond_t *cond);
SWIFT_THREAD_API swift_cond_t *swift_new_cond(void);
SWIFT_THREAD_API void swift_del_cond(swift_cond_t *cond);
SWIFT_THREAD_API swift_cond_t *swift_copy_cond(swift_cond_t *cond);
SWIFT_THREAD_API bool swift_cond_wait(swift_cond_t *cond, swift_mutex_t *mutex);
SWIFT_THREAD_API bool swift_cond_timed_wait(swift_cond_t *cond,
	swift_mutex_t *mutex, swift_time_t time);
SWIFT_THREAD_API bool swift_cond_signal(swift_cond_t *cond);
SWIFT_THREAD_API bool swift_cond_broadcast(swift_cond_t *cond);

#endif /* SWIFT_THREAD_COND_H */
