Been using this lib for a while though and always had a windows alert and an UNHANDLED EXCEPTION alert in the debug window when exiting a program but as the code was never actually being quit I never bothered looking for it until today and it turns out my thread is causing the issue
I am setting the thread up with the following command
// Create a Mutex
mx_mutex=ThMutexCreate()
// Start a new thread
IF ThThreadCreate("Interrupt")=FALSE
PRINT "Can't create thread", 0,0
SHOWSCREEN
MOUSEWAIT
END
ENDIF
But how should I be handling it on app close? I thought that by doing
ThMutexDelete(mx_mutex)
before the end command would do the trick but I still get the exception.
I am 100% certain its the thread that is causing the alert as when I dont initialise it then the code exits correctly.
Any help would be appreciated
EDIT: Found the issue, my code used the thread as a pseudo interrupt and the subroutine actually never quit, it did the code in a while 1 loop. Once I forced a graceful exit from the SUB before I deleted the Mutex it removed the error on shutdown. So the lesson is, make sure the thread is not running when you delete and exit
