*Experts* Merrion Posted May 16, 2003 *Experts* Posted May 16, 2003 I have a single function that may be called by more than one thread at once but I want it to be a critical region i.e. if one thread is already in it make the other thread wait for the region to be freed before entering. Any ideas? Quote Printer Monitor for .NET? - see Merrion Computing Ltd for details
*Experts* Merrion Posted May 16, 2003 Author *Experts* Posted May 16, 2003 Aha -put System.Runtime.CompilerServices.MethodImplAttribute attribute on the function signature and specify Synchronised...sweet. Quote Printer Monitor for .NET? - see Merrion Computing Ltd for details
*Gurus* divil Posted May 16, 2003 *Gurus* Posted May 16, 2003 If you ever need to have a smaller critical section where you want to lock access to one object, you can use the VB.NET Synclock block. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Gurus* Derek Stone Posted May 16, 2003 *Gurus* Posted May 16, 2003 A Mutex will also work quite well in many situations. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.