[M3devel] Win32 SuspendThread?

Jay jay.krell at cornell.edu
Sun Jan 19 02:02:56 CET 2014


For native I'm less worried now. For wow64 I'm still worried & hope to follow up further.

 - Jay

On Jan 17, 2014, at 11:11 PM, "Coleburn, Randy" <rcolebur at SCIRES.COM> wrote:

> Jay:
>  
> I’m very concerned about the threading not working properly on both 32-bit and 64-bit Windows.
>  
> The Thread Test program crashes for me on both platforms.
>  
> I haven’t tried your new test program yet.
>  
> --Randy
>  
> From: jayk123 at hotmail.com [mailto:jayk123 at hotmail.com] On Behalf Of Jay K
> Sent: Saturday, January 18, 2014 1:23 AM
> To: m3devel
> Subject: EXT:[M3devel] Win32 SuspendThread?
>  
>  This program also doesn't behave as expected, native, nothing to do with wow64. 
>  Anyone else please confirm: 
>    1) my expectations -- it should never print anything
>    2) their importance  -- garbage collector depends on it  
>    3) their not being met -- stuff gets printed 
>  This is in the CVS repository, scratch/wow64stack/sync2.cpp 
>  I am following up further. 
>  Maybe we should get cooperative suspend really going? 
> Thank you.
>  - Jay 
>  
> #include <stdio.h>
> #include <windows.h>
> volatile long value;
> unsigned long __stdcall Thread(PVOID parameter)
> {
>   while (1)
>    InterlockedIncrement(&value);
>   return 0;
> }
> int __cdecl main()
> {
>   HANDLE thread = CreateThread(0, 0, Thread, 0, 0, 0);
>   UINT i = 0;
>   while (1)
>   {
>     i += 1;
>     if (SuspendThread(thread) == (DWORD)-1)
>     {
>       printf("suspend failed %X\n", GetLastError());
>       Sleep(1);
>       continue;
>     }
>     volatile long a = value; 
>     volatile long b = value;
>     if (a != b)
>     {
>      printf("%d %d %d %d\n", i, a, b, b - a);
>     }
>     ResumeThread(thread);
>   }
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20140118/21485aaa/attachment-0002.html>


More information about the M3devel mailing list