Synclock in VB.Net = What in B4A?

dreamworld

Active Member
Licensed User
Longtime User
In VB.net, I can use Synclock to prevent multi threads from executing the same codes simultaneously.
I am wondering whether there is a similiar mechanism in B4A?
I tried to find a answer by searching on this website, but I got nothing.
 

agraham

Expert
Licensed User
Longtime User
The Threading library dates from early in Basic4android history when there was no other asynchronous mechanism available. Nowadays good practice is for libraries to provide the asynchronism when necessary so I'm not sure when you would need a lock. However there is a Lock object in the library.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I don't know what message you intend to convey by the post above but it comes over as terse and rude. Read the help for Lock.
A Semaphore initialised unlocked can be used to control
access to a resource. To acquire a resource the sequence for a thread is
Wait() - use resource - UnLock().
 
Upvote 0

dreamworld

Active Member
Licensed User
Longtime User
Excuse me. I did read the introduction of Lock, and then I tried to find some sample codes to help me understand how it works. Unfortunately, the sample I got after hard searching gave me an impression that Lock is for pausing a thread.
 
Upvote 0
Top