Delphi - Is there any equivalent to C# lock?
- by CaldonCZE
I'm writing a multi-threaded application in Delphi and need to use something to protect shared resources.
In C# I'd use the "lock" keyword:
private someMethod() {
lock(mySharedObj) {
//...do something with mySharedObj
}
}
In Delphi I couldn't find anything similar, I found just TThread.Synchronize(someMethod) method, which prevents potential conflicts by calling someMethod in main VCL thread, but it isn't exactly what I want to do....
Edit: I'm using Delphi 6