I've tried using a Mutex but with little success.
Would love a short fix (even if quick and dirty )
Code: Select all
Result.s
global x = CreateMutex()
Procedure DoSomeWork(*x)
Shared Result
LockMutex(x)
MM$ = peekS(*x)
UnLockMutex(x)
delay(random(500))
Result= MM$ + #TAB$ + str(random(100000))
PostEvent(999)
EndProcedure
Procedure.s LookUp(Input$)
shared InputCopy$
LockMutex(x)
InputCopy$ = Input$
UnLockMutex(x)
CreateThread(@DoSomeWork(), @InputCopy$)
EndProcedure
OpenWindow(0, 100, 100, 640, 380, "")
EditorGadget(1, 1, 1, 600, 300)
for u = 1 to 10
LookUp("INPUT "+str(random(10000)))
next
Repeat
e = WaitWindowEvent()
Select e
Case 999: AddGadgetItem(1, -1, Result)
Case #PB_Event_CloseWindow : End
EndSelect
Forever