What is the advantage of using this type of object to lock?
Why would there be an advantage to a specific type of lock object? As the manual states:
Best practice is to define a private object to lock on, or a private static object variable to protect data common to all instances.
Can I manipulate the buffer while code is still in //——– this region ?
Yes, from the same thread the lock()
statement was issued from. Other threads will have to wait there.
solved synchronization object [closed]