I noticed an increasing number of handles in taskmanager of my application when using the threadsafe mode. I striped down the code until I was able to locate the problematic line.
The number of handles is always increased by 1 after finishing a thread, if this thread is calling a procedure.
Here is some demo code to show the problem:
Code: Select all
Global finishThread.b = 0
; dummy
Procedure AProcedure()
EndProcedure
Procedure ThreadTest(*value)
Repeat
AProcedure() ; <== this call is causing the increasement of handles!
Delay(10)
Until finishThread
EndProcedure
OpenConsole()
t = CreateThread(@ThreadTest(), 1)
PrintN("Test-thread is started. Continue with Return.")
Input()
count = 0
Repeat
finishThread = 1
WaitThread(t)
PrintN("Thread is finished. Check number of handles now in taskmanager! Continue with Return.")
Input()
finishThread = 0
t = CreateThread(@ThreadTest(), 1)
PrintN("Thread is started again. Continue with Return to finish the thread.")
Input()
count = count + 1
Until count = 5
finishThread = 1
WaitThread(t)
PrintN("Thread Test finished.")
Input()
This only happens in threadsafe mode and leads to an increased consuming of handles for applications using threads.
Maybe someone else could confirm this behaviour? It should probably be considered as a PB bug.
System: PB 4.50 x86 - 32 bit WindowsXP
Best regards,
rlow

