/*
 * thr.h
 *
 */

#ifndef _ECAT_THR_H
#define _ECAT_THR_H

#if defined(SOLARIS_THREADS)
#include <thread.h>
#define SELF thr_self
#define MUTEX mutex_t
#define LOCK(A) mutex_lock(A)
#define UNLOCK(A) mutex_unlock(A)

#elif defined(POSIX_THREADS)
#include <pthread.h>
#define SELF pthread_self
#define MUTEX pthread_mutex_t
#define LOCK(A) pthread_mutex_lock(A)
#define UNLOCK(A) pthread_mutex_unlock(A)

#elif defined(NO_THREADS)
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#define SELF getpid
#define MUTEX int
#define LOCK(A)
#define UNLOCK(A)

#endif

extern void detach(void);
extern int spawnCatcher(sigset_t *);
extern int spawnThread(void *(*)(void *), int);

#endif /* _ECAT_THR_H */
