Fixed win32 handle leakage (thanks Trax)
authorEric Petit <titer@videolan.org>
Sun, 10 Jul 2005 12:51:21 +0000 (12:51 +0000)
committerEric Petit <titer@videolan.org>
Sun, 10 Jul 2005 12:51:21 +0000 (12:51 +0000)
 Default enabled support of threads on BeOS

git-svn-id: svn://svn.videolan.org/x264/trunk@273 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/encoder.c

index bab0134..4f5f6cd 100644 (file)
 #include <windows.h>
 #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 pthread_join(t,s)       WaitForSingleObject(t,INFINITE); \
+                                  CloseHandle(t); } 
 #define HAVE_PTHREAD 1
-#elif HAVE_PTHREAD
-#ifdef SYS_BEOS
+
+#elif defined(SYS_BEOS)
 #include <kernel/OS.h>
 #define pthread_t               thread_id
-#define pthread_create(t,u,f,d) *(t)=spawn_thread(f,"",10,d)
+#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)
-#else
+#define HAVE_PTHREAD 1
+
+#elif HAVE_PTHREAD
 #include <pthread.h>
 #endif
-#endif
 
 #include "common/common.h"
 #include "common/cpu.h"