mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-11-17 13:10:38 +00:00
766d278601
* Now using OpenAL as the main backend, ALSA has been deprecated... * soundcore-openal.[hc] - OpenAL sound output for emulator * alhelpers.[hc] - OpenAL suport files * mockingboard.[hc] , AY8910.[hc] , SSI263Phonemes.h - Mockingboard support ported from AppleWin ...
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
/*
|
|
* Apple // emulator for *nix
|
|
*
|
|
* This software package is subject to the GNU General Public License
|
|
* version 2 or later (your choice) as published by the Free Software
|
|
* Foundation.
|
|
*
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
|
*
|
|
*/
|
|
|
|
#include "common.h"
|
|
#include "win-shim.h"
|
|
|
|
pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, LPTHREAD_START_ROUTINE lpStartRoutine, LPVOID lpParameter, DWORD unused_dwCreationFlags, LPDWORD lpThreadId)
|
|
{
|
|
pthread_t a_thread = 0;
|
|
int err = 0;
|
|
if ((err = pthread_create(&a_thread, NULL, lpStartRoutine, lpParameter)))
|
|
{
|
|
ERRLOG("pthread_create");
|
|
}
|
|
|
|
return a_thread;
|
|
}
|
|
|
|
bool SetThreadPriority(pthread_t thread, int unused_nPriority)
|
|
{
|
|
// assuming time critical ...
|
|
|
|
int policy = sched_getscheduler(getpid());
|
|
|
|
int prio = 0;
|
|
if ((prio = sched_get_priority_max(policy)) < 0)
|
|
{
|
|
ERRLOG("OOPS sched_get_priority_max");
|
|
return 0;
|
|
}
|
|
|
|
int err = 0;
|
|
if ((err = pthread_setschedprio(thread, prio)))
|
|
{
|
|
ERRLOG("OOPS pthread_setschedprio");
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
bool GetExitCodeThread(pthread_t thread, unsigned long *lpExitCode)
|
|
{
|
|
if (pthread_tryjoin_np(thread, NULL))
|
|
{
|
|
if (lpExitCode)
|
|
{
|
|
*lpExitCode = STILL_ACTIVE;
|
|
}
|
|
}
|
|
else if (lpExitCode)
|
|
{
|
|
*lpExitCode = 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|