Got a thread that starts but never completes when the machine is locked and goes to sleep.
The thread calls a number of win32 api’s, then ends. There’s no window or accept loop involved.
It works fine when the machine is being used, but when I use Window Key + L to lock the machine and have the power settings set so the laptop goes to sleep, when I awaken the pc and log back in the thread doesnt resume or anything.
IF GLO:ResumeRecordingCheck = 0
Compile('_***_',_DEBUG_)
DSS('GLO:ResumeRecordingCheck = 0')
_***_
Compile('_***_',_DEBUG_)
DSS('Glo:RecordingThread = ' & Glo:RecordingThread )
_***_
IF Glo:RecordingThread = 0
Compile('_***_',_DEBUG_)
DSS('IF Glo:RecordingThread = 0')
_***_
Glo:RecordingThread = Start(RecordCurrentActivity)
Resume(Glo:RecordingThread)
End
Resume(Glo:RecordingThread)
End
Because the machine going to sleep could be suspending the thread, and Resume(ThreadNo) says each call decrements the suspend counter by one, I have the extra Resume(Glo:RecordingThread) outside of the initial IF statement, but this makes no difference.
So any ideas?
TIA
Edit.
Things I’ve toggled on and off to see if they make a difference but they dont.
Tried on Win XP vm and Win11 host.
Toggled Energy Saver mode in Win11
Compiled local and standalone.
Just cant seem to get this thread to resume when coming out of sleep.
Edit 2.
Doesnt matter if compiled in C6.3 or C11, the thread still never resumes.
So my only other thought, is the communication between debugview and the app disconnects, and then the thread completes, but never updates the Glo:RecordingThread variable.
So ProcessExplorer here we come…
Edit3.
Get ProcMon working and filtering on thread and now the thread in question is not even starting now when the app is started before I put the computer to sleep. WTF!
Edit4.
Found it. There was a Return towards the start of the procedure which was not resetting Glo:RecordingThread back to zero.
Sack the programmer. ![]()