28 #include "CLAM_windows.h"
37 typedef void *(*startfn) (
void *);
49 pthread_create(&thread,
NULL,(
startfn)SAudioThread,
this);
54 pthread_cleanup_push((
cleanfn)SAudioThreadCleanup,
this);
57 pthread_join(thread,
NULL);
59 pthread_cleanup_pop(1);
70 void BaseAudioApplication::UserMain(
void)
72 printf(
"Press enter to terminate\n");
76 void* BaseAudioApplication::SAudioThread(BaseAudioApplication *pThis)
92 res = SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS );
102 res = SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_HIGHEST );
103 err = GetLastError();
105 struct sched_param sched_param;
108 if (pthread_getschedparam(pthread_self(), &policy, &sched_param) < 0) {
109 printf(
"Scheduler getparam failed...\n");
111 sched_param.sched_priority = sched_get_priority_max(SCHED_RR)-1;
112 if (!pthread_setschedparam(pthread_self(), SCHED_RR, &sched_param)) {
113 printf(
"Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority);
123 void BaseAudioApplication::SAudioThreadCleanup(BaseAudioApplication *pThis)