view Isolated/SimpleThread.h @ 78:714ec6c5789d

Fixed a unit conversion bug in the Ogg Tremor decoder for SoundDecoder. This fixes out of memory issues with LoadAll on long, but still reasonably sized .ogg files on some Android devices. Ogg Vorbis uses seconds and we multiply by 1000 to convert to milliseconds. But Ogg Tremor already uses milliseconds but I was still multiplying by 1000. (The Tremor decoder was derived from the Vorbis decoder so this is actually the second time I hit a bug like this.)
author Eric Wing <ewing . public |-at-| gmail . com>
date Thu, 25 Oct 2012 16:12:50 -0700
parents 398d1cb12448
children
line wrap: on
line source

#ifndef SIMPLE_THREAD
#define SIMPLE_THREAD

#ifdef __cplusplus
extern "C" {
#endif
	
	#if defined(_WIN32)
		#if defined(SIMPLE_THREAD_BUILD_LIBRARY)
			#define SIMPLE_THREAD_DECLSPEC __declspec(dllexport)
		#else
			#define SIMPLE_THREAD_DECLSPEC
		#endif
	#else
		#if defined(SIMPLE_THREAD_BUILD_LIBRARY)
			#if defined (__GNUC__) && __GNUC__ >= 4
				#define SIMPLE_THREAD_DECLSPEC __attribute__((visibility("default")))
			#else
				#define SIMPLE_THREAD_DECLSPEC
			#endif
		#else
			#define SIMPLE_THREAD_DECLSPEC
		#endif
	#endif

	#if defined(_WIN32)
		#define SIMPLE_THREAD_CALL __cdecl
	#else
		#define SIMPLE_THREAD_CALL
	#endif

#include <stddef.h>

typedef struct SimpleThread SimpleThread;


extern SIMPLE_THREAD_DECLSPEC SimpleThread* SIMPLE_THREAD_CALL SimpleThread_CreateThread(int (*user_function)(void*), void* user_data);

extern SIMPLE_THREAD_DECLSPEC size_t SIMPLE_THREAD_CALL SimpleThread_GetCurrentThreadID(void);
extern SIMPLE_THREAD_DECLSPEC size_t SIMPLE_THREAD_CALL SimpleThread_GetThreadID(SimpleThread* simple_thread);

extern SIMPLE_THREAD_DECLSPEC void SIMPLE_THREAD_CALL SimpleThread_WaitThread(SimpleThread* simple_thread, int* thread_status);


extern SIMPLE_THREAD_DECLSPEC int SIMPLE_THREAD_CALL SimpleThread_GetThreadPriority(SimpleThread* simple_thread);
extern SIMPLE_THREAD_DECLSPEC void SIMPLE_THREAD_CALL SimpleThread_SetThreadPriority(SimpleThread* simple_thread, int priority_level);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif

#endif