I want to spy a value of some valiable with a debug purpose. So I create a new thread with this way:

invoke CreateThread, NULL, NULL, addr SpyThreadProc, NULL, NULL, addr hThread
mov dwNum, 10
mov dwNum, 20
mov dwNum, 30
mov dwNum, 40
invoke ExitProcess, dwExtCode
SpyThreadProc proc
    push ebx
    .while TRUE
        mov ebx, dwNum
        ;some further code
    pop ebx
SpyThreadProc endp
But my function SpyThreadProc sees only last value of the dwNum variable - 40 - and doesn't see 10, 20, 30. What I did wrong? This message was edited by vkim, on 7/1/2001 10:16:36 PM
Posted on 2001-07-01 22:14:00 by vkim
The problem is the thread doesnt have a chance to get going. What you're gonna have to do is make sure the thread is ready or wait a bit after calling CreateThread, so you're sure it's ready... But even then you're gonna have problems because of that "some further code" part in the thread it'll take to long before it can check the next value and even if it wasnt there it probaly still wouldnt get all the values.
Posted on 2001-07-02 01:39:00 by Soul~Drudge