D Doug Harrison [MVP] Mar 27, 2007 #2 hi.. Group, is there any lock statement like C# in managed C++? thanks Click to expand... For VC2005, see: lock Class http://msdn2.microsoft.com/en-us/library/ms177085(VS.80).aspx
hi.. Group, is there any lock statement like C# in managed C++? thanks Click to expand... For VC2005, see: lock Class http://msdn2.microsoft.com/en-us/library/ms177085(VS.80).aspx
G Guest Mar 28, 2007 #3 e.g., C# lock (x) { } C++/CLI: System::Threading::Monitor::Enter(x); try { } finally { System::Threading::Monitor::Exit(x); } -- David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C#/VB to C++ converter Instant Python: C#/VB to Python converter
e.g., C# lock (x) { } C++/CLI: System::Threading::Monitor::Enter(x); try { } finally { System::Threading::Monitor::Exit(x); } -- David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C#/VB to C++ converter Instant Python: C#/VB to Python converter
T Tom Widmer [VC++ MVP] Mar 28, 2007 #4 David said: e.g., C# lock (x) { } C++/CLI: System::Threading::Monitor::Enter(x); try { } finally { System::Threading::Monitor::Exit(x); } Click to expand... You can do much better than that: <msclr\lock.h> //... { msclr::lock l(x); //do stuff } //destructor of l exits monitor. Tom
David said: e.g., C# lock (x) { } C++/CLI: System::Threading::Monitor::Enter(x); try { } finally { System::Threading::Monitor::Exit(x); } Click to expand... You can do much better than that: <msclr\lock.h> //... { msclr::lock l(x); //do stuff } //destructor of l exits monitor. Tom