2 * psychlops_app_init_Win32.h
\r
3 * Psychlops Standard Library (Universal)
\r
5 * Last Modified 2005/12/19 by Kenchi HOSOKAWA
\r
6 * (C) 2005 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO
\r
9 #include "../../core/ApplicationInterfaces/psychlops_app_thread.h"
10 #include <windows.h>
\r
17 void* threadIDPtr(char *t) { return t; }
18 void* threadFuncPtr(char *t) { return (t+8); }
19 unsigned long __stdcall beginThread(void *param) {
20 void (*func)() = (void(*)())param;
27 for(int i=0; i<32; i++) memory[i] = 0;
29 Thread::Thread(void (*func)()) {
30 for(int i=0; i<32; i++) memory[i] = 0;
34 //TerminateThread(()threadIDPtr(memory))
36 void Thread::create(void (*func)()) {
37 CreateThread(NULL, 0, &beginThread, (void*)func, 0, (LPDWORD)threadIDPtr(memory));
40 void Thread::sleep(int microsec) {
43 void Thread::yield() {
46 int thread_priority_[5] = {
47 THREAD_PRIORITY_HIGHEST,
48 THREAD_PRIORITY_NORMAL,
49 THREAD_PRIORITY_LOWEST,
53 void Thread::priority( Priority priority ) {
54 SetThreadPriority(GetCurrentThread(), thread_priority_[priority]);
56 Thread::Priority Thread::priority() {
57 int priority = GetThreadPriority(GetCurrentThread());
59 case THREAD_PRIORITY_HIGHEST:
61 case THREAD_PRIORITY_NORMAL:
62 return Thread::NORMAL;
63 case THREAD_PRIORITY_LOWEST:
66 case THREAD_PRIORITY_IDLE: