CreateThread: procedure parameter needed?
Posted: Sun Jul 14, 2019 1:32 pm
When creating a thread by calling a procedure, is it mandatory for the procedure name to have a dummy parameter? I just realised my app did NOT have a parameter for a created thread, and so maybe it's why my app is crashing when built as an exe?
But when I tried to crash this test app by NOT having a parameter and building it as an exe, it doesn't crash when run as an exe, so I don't know if the param is needed or not. Could lack of a parameter cause an illegal memory access error though?
But when I tried to crash this test app by NOT having a parameter and building it as an exe, it doesn't crash when run as an exe, so I don't know if the param is needed or not. Could lack of a parameter cause an illegal memory access error though?
Code: Select all
Procedure test() ; No parameter here. Is it needed, though?
For n=1 To 10
Debug n
Next
EndProcedure
OpenWindow(0,200,200,200,100,"test",#PB_Window_SystemMenu)
ButtonGadget(0,20,20,100,25,"test")
Repeat
Event=WaitWindowEvent()
If Event=#PB_Event_Gadget
CreateThread(@test(),0)
EndIf
Until Event=#PB_Event_CloseWindow