/*
 * Copyright (C) 2008 The Trustees of Columbia University in the City of New York. 
 * All rights reserved.
 *
 * See the file LICENSE included in this distribution for details.
 */

#ifndef _THREADI_H
#define _THREADI_H

#ifndef _WENGO
#include "types.h"
#endif

#ifdef _WENGO
#include "p2pp/common/types.h"
#endif

#ifdef WIN32
#include <windows.h>
#endif

struct mutex_i {
#ifdef WIN32
  HANDLE uiMutex;
#endif

#ifdef _LINUX_
  uint32 uiMutex;
#endif
};


int32 CreateThreadI(void *(*start_routine)(void*), void *arg);

int32 WaitForThread(int32 iThread);

int32 ExitThread(int32 iThread);

int32 KillThread(int32 iThread);

int32 SuspendThread(int32 iThread);

int32 ResumeThread(int32 iThread);

//OS independent mutex functions
uint32 AllocMutexI(struct mutex_i& hMutex);
uint32 LockMutexI(struct mutex_i& hMutex);
uint32 UnlockMutexI(struct mutex_i& hMutex);
uint32 DeallocMutexI(struct mutex_i& hMutex);

#endif

