[vlc-devel] commit: WinCE: can't duplicate a thread handle (Geoffroy Couprie )

git version control git at videolan.org
Tue Oct 14 10:14:06 CEST 2008


vlc | branch: master | Geoffroy Couprie <geo.couprie at gmail.com> | Sun Oct 12 17:52:09 2008 +0200| [1bd36debcfc1e6b570313f9a71cca4af10a530ba] | committer: Geoffroy Couprie 

WinCE: can't duplicate a thread handle

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1bd36debcfc1e6b570313f9a71cca4af10a530ba
---

 src/misc/threads.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/misc/threads.c b/src/misc/threads.c
index 988c997..c6d5860 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -392,7 +392,6 @@ void vlc_cond_broadcast (vlc_cond_t *p_condvar)
 }
 
 #ifdef UNDER_CE
-# warning FIXME
 # define WaitForMultipleObjectsEx(a,b,c) WaitForMultipleObjects(a,b)
 #endif
 
@@ -510,8 +509,6 @@ int vlc_threadvar_create( vlc_threadvar_t *p_tls, void (*destr) (void *) )
 
 #if defined( LIBVLC_USE_PTHREAD )
     i_ret =  pthread_key_create( p_tls, destr );
-#elif defined( UNDER_CE )
-    i_ret = ENOSYS;
 #elif defined( WIN32 )
     /* FIXME: remember/use the destr() callback and stop leaking whatever */
     *p_tls = TlsAlloc();
@@ -526,7 +523,6 @@ void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
 {
 #if defined( LIBVLC_USE_PTHREAD )
     pthread_key_delete (*p_tls);
-#elif defined( UNDER_CE )
 #elif defined( WIN32 )
     TlsFree (*p_tls);
 #else
@@ -645,6 +641,7 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
 
     if (hThread)
     {
+#ifndef UNDER_CE
         /* Thread closes the handle when exiting, duplicate it here
          * to be on the safe side when joining. */
         if (!DuplicateHandle (GetCurrentProcess (), hThread,
@@ -655,6 +652,9 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
             free (th);
             return ENOMEM;
         }
+#else
+        th->handle = hThread;
+#endif
 
         ResumeThread (hThread);
         if (priority)
@@ -920,6 +920,7 @@ void __vlc_thread_join( vlc_object_t *p_this )
     FILETIME create_ft, exit_ft, kernel_ft, user_ft;
     int64_t real_time, kernel_time, user_time;
 
+#ifndef UNDER_CE
     if( ! DuplicateHandle(GetCurrentProcess(),
             p_priv->thread_id->handle,
             GetCurrentProcess(),
@@ -931,6 +932,9 @@ void __vlc_thread_join( vlc_object_t *p_this )
         p_priv->b_thread = false;
         return; /* We have a problem! */
     }
+#else
+    hThread = p_priv->thread_id->handle;
+#endif
 
     vlc_join( p_priv->thread_id, NULL );
 




More information about the vlc-devel mailing list