Warning
This feature was added in build 33.
This little article covers mutual exclusiveness. Two instructions that you use to manage mutex variables are:
lockand,unlock.
.data
@mutex
string testinggg: ""
.start
thread Funnyx -> {
fetch testinggg
lock this
mov &testinggg, "Testing the funny string"
mov tlr, testinggg
call std::ios::writeln
unlock this
}
lock &testinggg
mov &testinggg, "Testing the funny string from main thread"
mov tlr, testinggg
call std::ios::writeln
unlock &testinggg
await &Funnyx
mov tlr, &Funnyx
sysenter "thread"
mov fdx, 1
syscallThe mutex attribute allows you to mark variables as mutually exclusive so that only one thread can manipulate with a variable, forcing other variables to wait for an unlock.
Note
After a specific thread ends, you do not have to use unlock to unlock any locked mutexes. The thread will do it for you, however using unlock is a good practice since it boosts your program performance by immediatelly letting other threads use a specific mutex.