/*
 * zzThread.h
 * 
 * The Zen API 
 * Copyright (C) 2008-2009 by LMI Technologies Inc.
 * 
 * Licensed under The MIT License.
 * Redistributions of files must retain the above copyright notice.
 */
#ifndef LMITECH_ZZTHREAD_H_INCLUDED
#define LMITECH_ZZTHREAD_H_INCLUDED

#include <zThread.h>
#include <zApiBegin.h>

#ifdef ZAPI_WINDOWS

#   include <windows.h>
#   include <process.h>

#   define zTHREAD_HANDLE           HANDLE
#   define zTHREAD_RETURN           unsigned int

#elif defined(ZAPI_LINUX)

#   include <pthread.h>
#   include <unistd.h>

#   define zTHREAD_HANDLE           pthread_t
#   define zTHREAD_RETURN      	    void*

#endif

#define zTHREAD_SPEC                zTHREAD_RETURN ZAPI_CALL

typedef struct zThreadClass
{
    zTHREAD_HANDLE thread;
    zThreadCallback callback;
    zHandle context;
    zStatus returnValue;
} zThreadClass;

typedef struct zThreadStartInfo
{
    zThreadCallback callback;
    zHandle context;
} zThreadStartInfo;

static zTHREAD_SPEC zThread_EntryPoint(void *arg);
ZAPI_EXPORT(zStatus) zThread_StartHelper(zThread thread, zThreadStartInfo* info);

#include <zApiEnd.h>

#endif          /* #ifndef LMITECH_ZZTHREAD_H_INCLUDED */
