/*
** Automatically generated from `thread.semaphore.m'
** by the Mercury compiler,
** version 14.01.1, configured for x86_64-apple-darwin13.3.0.
** Do not edit.
**
** The autoconfigured grade settings governing
** the generation of this C file were
**
** TAG_BITS=2
** UNBOXED_FLOAT=no
** PREGENERATED_DIST=yes
** HIGHLEVEL_CODE=yes
**
** END_OF_C_GRADE_INFO
*/


/* :- module thread.semaphore. */
/* :- interface. */

#ifndef MR_HEADER_GUARD_thread__semaphore
#define MR_HEADER_GUARD_thread__semaphore

#ifdef __cplusplus
extern "C" {
#endif

#include "mercury.h"


#ifndef THREAD__SEMAPHORE_DECL_GUARD
#define THREAD__SEMAPHORE_DECL_GUARD
#include "thread.mih"
#line 66 "thread.semaphore.m"

    #include <stdio.h>
    #include "mercury_context.h"
    #include "mercury_thread.h"

    typedef struct ML_SEMAPHORE_STRUCT {
        MR_Integer  count;
#ifndef MR_HIGHLEVEL_CODE
        MR_Context  *suspended_head;
        MR_Context  *suspended_tail;
#else
  #ifdef MR_THREAD_SAFE
        MercuryCond cond;
  #endif 
#endif
#ifdef MR_THREAD_SAFE
        MercuryLock lock;
#endif
    } ML_Semaphore;

#line 102 "thread.semaphore.m"

extern void
ML_finalize_semaphore(void *obj, void *cd);

#line 421 "thread.semaphore.m"

/*
INIT mercury_sys_init_semaphore_modules
*/

#ifndef MR_HIGHLEVEL_CODE
    MR_define_extern_entry(mercury__thread__semaphore__nop);
#endif

#endif




#line 77 "thread.semaphore.mih.tmp"
extern const MR_TypeCtorInfo_Struct mercury__thread__semaphore__thread__semaphore__type_ctor_info_semaphore_0;

#line 100 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore____Compare____semaphore_0_0(
#line 100 "thread.semaphore.m"
  MR_Word * mercury__thread__semaphore__param_1,
#line 100 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_2,
#line 100 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_3);

#line 100 "thread.semaphore.m"
MR_bool MR_CALL 
mercury__thread__semaphore____Unify____semaphore_0_0(
#line 100 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_1,
#line 100 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_2);

#line 373 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore__try_wait_2_4_p_0(
#line 373 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_1,
#line 373 "thread.semaphore.m"
  MR_Integer * mercury__thread__semaphore__param_2);

#line 57 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore__signal_3_p_0(
#line 57 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_1);

#line 50 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore__try_wait_4_p_0(
#line 50 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_1,
#line 50 "thread.semaphore.m"
  MR_Word * mercury__thread__semaphore__param_2);

#line 44 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore__wait_3_p_0(
#line 44 "thread.semaphore.m"
  MR_Box mercury__thread__semaphore__param_1);

#line 38 "thread.semaphore.m"
MR_Box MR_CALL 
mercury__thread__semaphore__init_1_f_0(
#line 38 "thread.semaphore.m"
  MR_Integer mercury__thread__semaphore__param_1);

#line 34 "thread.semaphore.m"
void MR_CALL 
mercury__thread__semaphore__init_3_p_0(
#line 34 "thread.semaphore.m"
  MR_Box * mercury__thread__semaphore__param_1);

void mercury__thread__semaphore__init(void);
void mercury__thread__semaphore__init_type_tables(void);
void mercury__thread__semaphore__init_debugger(void);

#ifdef __cplusplus
}
#endif

#endif /* MR_HEADER_GUARD_thread.semaphore */

/* :- end_interface thread.semaphore. */
