src/thread_os2.cpp
author miham
Tue, 15 Jul 2008 23:27:28 +0000
changeset 11149 f3ff534dded8
parent 10866 242436c016b8
permissions -rw-r--r--
(svn r13707) -Update: WebTranslator2 update to 2008-07-16 01:21:36
brazilian_portuguese - 3 fixed by tucalipe (3)
bulgarian - 78 fixed, 230 changed by thetitan (3), groupsky (305)
catalan - 3 fixed by arnaullv (3)
dutch - 3 fixed by webfreakz (3)
italian - 3 changed by lorenzodv (3)
korean - 4 fixed, 5 changed by leejaeuk5 (9)
russian - 3 fixed by Smoky555 (3)
slovenian - 4 fixed by Necrolyte (4)
spanish - 3 fixed by eusebio (3)
swedish - 4 fixed by daishan (4)
ukrainian - 2 fixed by mad (2)
/* $Id$ */

/** @file thread_os2.cpp OS2 implementation of Threads. */

#include "stdafx.h"
#include "thread.h"

#if 0
#include "debug.h"
#include "core/alloc_func.hpp"
#include <stdlib.h>

#define INCL_DOS
#include <os2.h>
#include <process.h>

struct OTTDThread {
	TID thread;
	OTTDThreadFunc func;
	void *arg;
	void *ret;
};

static void Proxy(void *arg)
{
	OTTDThread *t = (OTTDThread *)arg;
	t->ret = t->func(t->arg);
}

OTTDThread *OTTDCreateThread(OTTDThreadFunc function, void *arg)
{
	OTTDThread *t = MallocT<OTTDThread>(1);

	t->func = function;
	t->arg  = arg;
	t->thread = _beginthread(Proxy, NULL, 32768, t);
	if (t->thread != (TID)-1) {
		return t;
	} else {
		free(t);
		return NULL;
	}
}

void *OTTDJoinThread(OTTDThread *t)
{
	if (t == NULL) return NULL;

	DosWaitThread(&t->thread, DCWW_WAIT);
	void *ret = t->ret;
	free(t);
	return ret;
}

void OTTDExitThread()
{
	_endthread();
}

#endif

/* static */ ThreadObject *ThreadObject::New(OTTDThreadFunc proc, void *param)
{
	return NULL;
}

/* static */ ThreadObject *ThreadObject::AttachCurrent()
{
	return NULL;
}

/* static */ uint ThreadObject::CurrentId()
{
	return -1;
}

/* static */ ThreadSemaphore *ThreadSemaphore::New()
{
	return NULL;
}