Delphi - Is there any equivalent to C# lock?

Posted by CaldonCZE on Stack Overflow See other posts from Stack Overflow or by CaldonCZE
Published on 2010-06-11T13:11:30Z Indexed on 2010/06/11 14:02 UTC
Read the original article Hit count: 198

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about delphi