when I want to change listicon text in thread it becomes unlimited
Just comment line 3 and all will be ok, multithreading is enabled
PB6.21 final Win10 x64
Both codes WaitThread or While-Wend are freezing
Code: Select all
Procedure thread(thread_param)
Delay(1000)
SetGadgetItemText(0, 0, "Wait")
Delay(1000)
EndProcedure
Procedure.s start_thread()
thread = CreateThread(@thread(), 0)
If thread
DisableGadget(1, 1)
SetGadgetItemText(0, 0, "Start")
Debug "start"
WaitThread(thread)
; While IsThread(thread)
; Debug "tick"
; Delay(100)
; Wend
SetGadgetItemText(0, 0, "Done")
Debug "done"
DisableGadget(1, 0)
EndIf
EndProcedure
If OpenWindow(0, 100, 200, 200, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
ListIconGadget(0, 5, 5, 190, 225, "Status", 150)
AddGadgetItem(0, 0, "?")
ButtonGadget(1, 5, 235, 190, 20, "Start thread")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 1
start_thread()
EndIf
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf