If I understood correctly, you need something like this:
static object lockMethod2 = new object(); static object lockMethod3 = new object(); public static void Method1() { lock (lockMethod2) lock (lockMethod3) {
This allows method3 to execute if method2 is running, and vice versa, while method1 must wait for both. Of course, methods 2 and 3 will not work while 1 is executing.
Paolo tedesco
source share