<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'> This program also doesn't behave as expected, native, nothing to do with wow64. <BR> Anyone else please confirm: <BR> 1) my expectations -- it should never print anything<BR> 2) their importance -- garbage collector depends on it <BR> 3) their not being met -- stuff gets printed <BR> This is in the CVS repository, scratch/wow64stack/sync2.cpp <BR> I am following up further. <BR> Maybe we should get cooperative suspend really going? <BR>Thank you.<BR> - Jay <BR> <BR>#include <stdio.h><br>#include <windows.h><BR>volatile long value;<BR>unsigned long __stdcall Thread(PVOID parameter)<br>{<br> while (1)<br> InterlockedIncrement(&value);<br> return 0;<br>}<BR>int __cdecl main()<br>{<br> HANDLE thread = CreateThread(0, 0, Thread, 0, 0, 0);<br> UINT i = 0;<br> while (1)<br> {<br> i += 1;<br> if (SuspendThread(thread) == (DWORD)-1)<br> {<br> printf("suspend failed %X\n", GetLastError());<br> Sleep(1);<br> continue;<br> }<br> volatile long a = value; <br> volatile long b = value;<br> if (a != b)<br> {<br> printf("%d %d %d %d\n", i, a, b, b - a);<br> }<br> ResumeThread(thread);<br> }<br>}<br><BR> </div></body>
</html>