[x264-devel] Re: x264: svn commit r250 (titer)

Dario Andrade dario at sinistro.net
Mon Jun 6 21:11:19 CEST 2005


> 
> >I'm getting a lot of exceptions about invalid handle thrown when x264
> calls
> >CloseHandle after WaitForSingleObject. I guess it's because the thread
> doesn't
> >exists anymore after WaitForSingleObject returns. When I commented
> >CloseHandle, the threads are destroyed and no exceptions are thrown.
> 
> It's very strange anyway that this will causes exceptions, I've seen
> some example of create/wait thread on internet and most examples
> are not calling CloseHandle, but the correct use is to call CloseThread
> after WaitForSingleObject.

After a thread is created in win32, CloseHandle should be called to close
the kernel object handle, even if it the thread has already exited (and even
at start, e.g., when you don't need it). I guess, from the code, that is the
right way to do it. My only concern is to understand if creating and
destroying threads at each frame is not too much of a overhead.
Perhaps creating them once in init, and using semaphores to indicate task
completion would be a better idea.

Cheers,
Dario Andrade
IP.TV

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list