|
Listing 5-8 extracted from chapter
Processes, threads and synchronization
Listing 5-7< > Listing 5-9
This listing can be compiled with the command line: csc.exe /target:library Example_5_8.cs Errors: 0 Warnings: 0
Example_5_8.cs
class Foo {
private static object staticSyncRoot = new object();
private object instanceSyncRoot = new object();
public static void StaticFct() {
lock ( staticSyncRoot ) { /*...*/ }
}
public void InstanceFct() {
lock ( instanceSyncRoot ) { /*...*/ }
}
}
Copyright Patrick Smacchia 2006 2007
|