This command allows to prevent multiple virtual users to access some shared resource concurrently.
When a virtual user calls LockMutex that is already locked by another virtual user, it is suspended until the mutex is released by UnlockMutex.
A string literal defining the mutex name.
// Get the curent User Id
Load UserId Into szUserId;
// Open a file to log current User Id, this file is shared by all virtual users
Open "DataFile.txt" As sharedFile For Output;
// Lock a mutex to prevent other virtual users to write in the shared file at the same time
LockMutex "Mutex for sharedFile";
Write szUserId To sharedFile;
Write "\n" To sharedFile;
// Unlock the mutex to resume execution for other virtual users
UnlockMutex "Mutex for sharedFile";
Copyright © AgileLoad. All rights reserved.