Files @ r9769:36b8a3257c9b
Branch filter:

Location: cpp/openttd-patchpack/source/src/thread_os2.cpp

translators
(svn r13905) -Update: WebTranslator2 update to 2008-08-01 02:27:37
brazilian_portuguese - 22 fixed by tucalipe (22)
dutch - 9 fixed by habell (9)
estonian - 4 fixed by kristjans (4)
french - 5 fixed, 1 changed by glx (6)
galician - 105 fixed, 206 changed by Condex (311)
italian - 5 fixed, 2 changed by lorenzodv (7)
korean - 15 fixed by leejaeuk5 (15)
portuguese - 48 fixed by supra90 (48)
slovak - 30 fixed by lengyel (30)
spanish - 9 fixed by eusebio (9)
ukrainian - 22 fixed by mad (22)
/* $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;
}