Amiga.org
Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: ami_stuff on April 06, 2011, 10:32:39 AM
-
and does it require libpthread as AmigaOS 4.x port?
/*****************************************************************************
* Some things that are OS dependant
****************************************************************************/
#ifdef WIN32
# include
# define pthread_t HANDLE
# define pthread_create(t,u,f,d) *(t)=CreateThread(NULL,0,f,d,0,NULL)
# define pthread_join(t,s) { WaitForSingleObject(t,INFINITE); \
CloseHandle(t); }
# define sched_yield() Sleep(0);
static __inline int pthread_num_processors_np()
{
DWORD p_aff, s_aff, r = 0;
GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR) &p_aff, (PDWORD_PTR) &s_aff);
for(; p_aff != 0; p_aff>>=1) r += p_aff&1;
return r;
}
#elif defined(__amigaos4__)
# include
# include
# define sched_yield() IDOS->Delay(1)
#elif defined(SYS_BEOS)
# include
# define pthread_t thread_id
# define pthread_create(t,u,f,d) { *(t)=spawn_thread(f,"",10,d); \
resume_thread(*(t)); }
# define pthread_join(t,s) wait_for_thread(t,(long*)s)
# define sched_yield() snooze(0) /* is this correct? */
#else
# include
#endif