Hi all,
in my B4J server app I have a map containing data that can be modified from 3 different proceesses. One in a timer in the main thread and other in Server.Handler and WebSocket.
The code is something like this stupid sample:
I wonder if 2 events may occour in the same moment and create errors.
Is it a good solution to manage a global flag "MapBusy" like this ?
in my B4J server app I have a map containing data that can be modified from 3 different proceesses. One in a timer in the main thread and other in Server.Handler and WebSocket.
The code is something like this stupid sample:
B4X:
x=mymap.get(credits)
x=x+5
mymap.put(credits,x)
I wonder if 2 events may occour in the same moment and create errors.
Is it a good solution to manage a global flag "MapBusy" like this ?
B4X:
Do while MapBusy is true
Loop
MapBusy=true
..... works with the map
MapBusy=false