/*
** 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.
*/
#ifndef THREAD__SEMAPHORE_MH
#define THREAD__SEMAPHORE_MH

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MR_HIGHLEVEL_CODE
#include "mercury.h"
#else
  #ifndef MERCURY_HDR_EXCLUDE_IMP_H
  #include "mercury_imp.h"
  #endif
#endif
#ifdef MR_DEEP_PROFILING
#include "mercury_deep_profiling.h"
#endif

#ifndef THREAD__SEMAPHORE_DECL_GUARD
#define THREAD__SEMAPHORE_DECL_GUARD
#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 49 "thread.semaphore.mh.tmp"
#line 102 "thread.semaphore.m"

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

#line 55 "thread.semaphore.mh.tmp"
#line 421 "thread.semaphore.m"

/*
INIT mercury_sys_init_semaphore_modules
*/

#ifndef MR_HIGHLEVEL_CODE
    MR_define_extern_entry(mercury__thread__semaphore__nop);
#endif

#line 66 "thread.semaphore.mh.tmp"

#endif

#ifdef __cplusplus
}
#endif

#endif /* THREAD__SEMAPHORE_MH */
