apple2ix/src/win-shim.c
Aaron Culliney 766d278601 First cut at supporting mockingboard.
* 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 ...
2013-11-12 23:43:16 -08:00

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;
}