-#if defined( WIN32 ) || defined( UNDER_CE )
- {
- /* When using the MSVCRT C library you have to use the _beginthreadex
- * function instead of CreateThread, otherwise you'll end up with
- * memory leaks and the signal functions not working (see Microsoft
- * Knowledge Base, article 104641) */
-#if defined( UNDER_CE )
- DWORD threadId;
- HANDLE hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)func,
- (LPVOID)p_data, CREATE_SUSPENDED,
- &threadId );
-#else
- unsigned threadId;
- uintptr_t hThread = _beginthreadex( NULL, 0,
- (LPTHREAD_START_ROUTINE)func,
- (void*)p_data, CREATE_SUSPENDED,
- &threadId );
-#endif
- p_priv->thread_id.id = (DWORD)threadId;
- p_priv->thread_id.hThread = (HANDLE)hThread;
- ResumeThread((HANDLE)hThread);
- }
-
- i_ret = ( p_priv->thread_id.hThread ? 0 : 1 );
-
- if( i_ret && i_priority )
- {
- if( !SetThreadPriority(p_priv->thread_id.hThread, i_priority) )
- {
- msg_Warn( p_this, "couldn't set a faster priority" );
- i_priority = 0;
- }
- }
-
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
- p_priv->thread_id = spawn_thread( (thread_func)func, psz_name,
- i_priority, p_data );
- i_ret = resume_thread( p_priv->thread_id );