[Mono-dev] [PATCH] Changes for CreateThread calls.
Hi, The attached patch fixes some problems I was seeing with thread IDs on Winx64. What I found was that the thread ID argument of CreateThread is a ulong which is not 64 bits on Winx64. So when called with the address of a size variable the top 32 bits are garbage. This patch simply initializes all thread ID variables to zero before calling CreateThread. Is there a better way to fix this? -bill 2009-03-25 Bill Holmes * appdomain.c (mono_domain_unload), * attach.c (transport_start_receive), * threads.c (mono_thread_create_internal), * threads.c (ves_icall_System_Threading_Thread_Thread_internal): Initialize the tid variable to 0 before calls to CreateThread. This is needed for Winx64 because that argument is only 32 bits. Code is contributed under MIT/X11 license. CreateThread.patch Description: Binary data ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [PATCH] Changes for CreateThread calls.
Wouldn't just this be enough? in mono_thread_create_internal: #ifdef PLATFORM_WIN32 DWORD tid; #else gsize tid; #endif Kornél Bill Holmes wrote: > Hi, > > The attached patch fixes some problems I was seeing with thread IDs on Winx64. > > What I found was that the thread ID argument of CreateThread is a > ulong which is not 64 bits on Winx64. So when called with the address > of a size variable the top 32 bits are garbage. This patch simply > initializes all thread ID variables to zero before calling > CreateThread. Is there a better way to fix this? > > -bill > > > > 2009-03-25 Bill Holmes > > * appdomain.c (mono_domain_unload), > * attach.c (transport_start_receive), > * threads.c (mono_thread_create_internal), > * threads.c (ves_icall_System_Threading_Thread_Thread_internal): > Initialize the tid variable to 0 before calls to CreateThread. > This is needed for Winx64 because that argument is only 32 bits. > > Code is contributed under MIT/X11 license. > > > > > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [PATCH] Changes for CreateThread calls.
Kornél, Yes that would work too. Thanks -bill 2009/3/25 Kornél Pál : > Wouldn't just this be enough? > > in mono_thread_create_internal: > > #ifdef PLATFORM_WIN32 > DWORD tid; > #else > gsize tid; > #endif > > Kornél > > Bill Holmes wrote: >> >> Hi, >> >> The attached patch fixes some problems I was seeing with thread IDs on >> Winx64. >> >> What I found was that the thread ID argument of CreateThread is a >> ulong which is not 64 bits on Winx64. So when called with the address >> of a size variable the top 32 bits are garbage. This patch simply >> initializes all thread ID variables to zero before calling >> CreateThread. Is there a better way to fix this? >> >> -bill >> >> >> >> 2009-03-25 Bill Holmes >> >> * appdomain.c (mono_domain_unload), >> * attach.c (transport_start_receive), >> * threads.c (mono_thread_create_internal), >> * threads.c (ves_icall_System_Threading_Thread_Thread_internal): >> Initialize the tid variable to 0 before calls to CreateThread. >> This is needed for Winx64 because that argument is only 32 bits. >> >> Code is contributed under MIT/X11 license. >> >> >> >> >> ___ >> Mono-devel-list mailing list >> Mono-devel-list@lists.ximian.com >> http://lists.ximian.com/mailman/listinfo/mono-devel-list > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [PATCH] Changes for CreateThread calls.
Hi, This is now fixed in r130385 by adding a new 'mono_create_thread' helper function. Zoltan 2009/3/25 Bill Holmes > Hi, > > The attached patch fixes some problems I was seeing with thread IDs on > Winx64. > > What I found was that the thread ID argument of CreateThread is a > ulong which is not 64 bits on Winx64. So when called with the address > of a size variable the top 32 bits are garbage. This patch simply > initializes all thread ID variables to zero before calling > CreateThread. Is there a better way to fix this? > > -bill > > > > 2009-03-25 Bill Holmes > >* appdomain.c (mono_domain_unload), >* attach.c (transport_start_receive), >* threads.c (mono_thread_create_internal), >* threads.c (ves_icall_System_Threading_Thread_Thread_internal): > Initialize the tid variable to 0 before calls to CreateThread. > This is needed for Winx64 because that argument is only 32 bits. > >Code is contributed under MIT/X11 license. > > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [PATCH] Changes for CreateThread calls.
Hi, That fix does not work with the MSVC builds. That attached patch is one way to fix it. thanks -bill On Fri, Mar 27, 2009 at 9:36 AM, Zoltan Varga wrote: > Hi, > > This is now fixed in r130385 by adding a new 'mono_create_thread' helper > function. > > Zoltan > > 2009/3/25 Bill Holmes >> >> Hi, >> >> The attached patch fixes some problems I was seeing with thread IDs on >> Winx64. >> >> What I found was that the thread ID argument of CreateThread is a >> ulong which is not 64 bits on Winx64. So when called with the address >> of a size variable the top 32 bits are garbage. This patch simply >> initializes all thread ID variables to zero before calling >> CreateThread. Is there a better way to fix this? >> >> -bill >> >> >> >> 2009-03-25 Bill Holmes >> >> * appdomain.c (mono_domain_unload), >> * attach.c (transport_start_receive), >> * threads.c (mono_thread_create_internal), >> * threads.c (ves_icall_System_Threading_Thread_Thread_internal): >> Initialize the tid variable to 0 before calls to CreateThread. >> This is needed for Winx64 because that argument is only 32 bits. >> >> Code is contributed under MIT/X11 license. >> >> ___ >> Mono-devel-list mailing list >> Mono-devel-list@lists.ximian.com >> http://lists.ximian.com/mailman/listinfo/mono-devel-list >> > > ttypes.patch Description: Binary data ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] [PATCH] Changes for CreateThread calls.
Hi, That looks ok. Zoltan On Fri, Mar 27, 2009 at 9:29 PM, Bill Holmes wrote: > Hi, > > That fix does not work with the MSVC builds. That attached patch is > one way to fix it. > > thanks > -bill > > On Fri, Mar 27, 2009 at 9:36 AM, Zoltan Varga wrote: > > Hi, > > > > This is now fixed in r130385 by adding a new 'mono_create_thread' helper > > function. > > > > Zoltan > > > > 2009/3/25 Bill Holmes > >> > >> Hi, > >> > >> The attached patch fixes some problems I was seeing with thread IDs on > >> Winx64. > >> > >> What I found was that the thread ID argument of CreateThread is a > >> ulong which is not 64 bits on Winx64. So when called with the address > >> of a size variable the top 32 bits are garbage. This patch simply > >> initializes all thread ID variables to zero before calling > >> CreateThread. Is there a better way to fix this? > >> > >> -bill > >> > >> > >> > >> 2009-03-25 Bill Holmes > >> > >>* appdomain.c (mono_domain_unload), > >>* attach.c (transport_start_receive), > >>* threads.c (mono_thread_create_internal), > >>* threads.c (ves_icall_System_Threading_Thread_Thread_internal): > >> Initialize the tid variable to 0 before calls to CreateThread. > >> This is needed for Winx64 because that argument is only 32 > bits. > >> > >>Code is contributed under MIT/X11 license. > >> > >> ___ > >> Mono-devel-list mailing list > >> Mono-devel-list@lists.ximian.com > >> http://lists.ximian.com/mailman/listinfo/mono-devel-list > >> > > > > > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list