}
#endif
-#if defined(SYS_LINUX) && defined(HAVE_PTHREAD)
+#ifdef USE_REAL_PTHREAD
+#ifdef SYS_MINGW
+#define x264_lower_thread_priority(p)\
+{\
+ x264_pthread_t handle = pthread_self();\
+ struct sched_param sp;\
+ int policy = SCHED_OTHER;\
+ pthread_getschedparam( handle, &policy, &sp );\
+ sp.sched_priority -= p;\
+ pthread_setschedparam( handle, policy, &sp );\
+}
+#else
#include <unistd.h>
#define x264_lower_thread_priority(p) { UNUSED int nice_ret = nice(p); }
+#endif /* USE_REAL_PTHREAD */
#else
#define x264_lower_thread_priority(p)
#endif
if( x264_macroblock_cache_init( look_h ) )
goto fail;
- UNUSED x264_pthread_attr_t attr;
- if( x264_pthread_attr_init( &attr ) )
+ if( x264_pthread_create( &look_h->thread_handle, NULL, (void *)x264_lookahead_thread, look_h ) )
goto fail;
-#if defined(USE_REAL_PTHREAD) && !defined(SYS_LINUX)
- int offset = sched_get_priority_max( SCHED_OTHER );
- x264_log( h, X264_LOG_DEBUG, "setting priority of lookahead thread to %d\n", offset );
- struct sched_param sp;
- pthread_attr_getschedparam( &attr, &sp );
- sp.sched_priority = offset;
- pthread_attr_setschedparam( &attr, &sp );
-#endif
-
- if( x264_pthread_create( &look_h->thread_handle, &attr, (void *)x264_lookahead_thread, look_h ) )
- goto fail;
-
- x264_pthread_attr_destroy( &attr );
return 0;
fail: