Re: [PATCH] MSVC: Windows-native implementation for subset of Pthreads API
- From
Nicolas Pitre <nico@fluxnic.net>
- Date
- Nov 5, 2009, 19:39 UTC
- Message-ID
- <alpine.LFD.2.00.0911051434090.10340@xanadu.home>
- In-Reply-To
- <1257439548-9258-1-git-send-email-ahaczewski@gmail.com>
On Thu, 5 Nov 2009, Andrzej K. Haczewski wrote:
Show 6 quoted lines
> +static unsigned __stdcall win32_start_routine(void *arg)
> +{
> + pthread_t *thread = arg;
> + thread->value = thread->start_routine(thread->arg);
> + return 0;
> +}I suppose you could reuse thread->arg for both the argument and the returned value to save a word.
> +int win32_pthread_join(pthread_t *thread, void **value_ptr)
> +{
> + DWORD result = WaitForSingleObject((HANDLE)thread->handle, INFINITE);Why are you casting thread->handle here? Why not simply declaring it as a HANDLE?
Otherwise this looks pretty good now.
Nicolas