win32.c
changeset 2285 3193cbd1ba88
parent 2283 bbf48bc7afda
child 2334 b4e5c353bf38
equal deleted inserted replaced
2284:552f3dddd93a 2285:3193cbd1ba88
  1191 		return true;
  1191 		return true;
  1192 	}
  1192 	}
  1193 	return false;
  1193 	return false;
  1194 }
  1194 }
  1195 
  1195 
  1196 static HANDLE hThread;
       
  1197 
       
  1198 bool CreateOTTDThread(void *func, void *param)
       
  1199 {
       
  1200 	DWORD dwThreadId;
       
  1201 	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, param, 0, &dwThreadId);
       
  1202 	SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
       
  1203 
       
  1204 	return hThread != NULL;
       
  1205 }
       
  1206 
       
  1207 void JoinOTTDThread(void)
       
  1208 {
       
  1209 	if (hThread == NULL) return;
       
  1210 
       
  1211 	WaitForSingleObject(hThread, INFINITE);
       
  1212 	if (!CloseHandle(hThread)) DEBUG(misc, 0) ("Failed to close thread handle!");
       
  1213 }
       
  1214 
       
  1215 
  1196 
  1216 void CSleep(int milliseconds)
  1197 void CSleep(int milliseconds)
  1217 {
  1198 {
  1218 	Sleep(milliseconds);
  1199 	Sleep(milliseconds);
  1219 }
  1200 }