Therefore, you can supply an optional name when you create a Mutex
instance. Providing a name is the easiest way for another process to identify and open the
mutex. Since all Mutex names exist in the global namespace of the entire operating system, it
is important to give the Mutex a sufficiently unique name so that it won??™t collide with Mutex
names created by other applications. We recommend using a name that is based on the string
formof a GUID generated by GUIDGEN.exe.
nNote We mentioned that the names of kernel objects are global to the entire machine. That statement is
not entirely true if you consider Windows XP fast user switching and Terminal Services. In those cases, the
namespace that contains the name of these kernel objects is instanced for each logged-in user. For times
when you really do want your name to exist in the global namespace, you can prefix the name with the
special string "\Global".
CHAPTER 13 n THREADING 305
If everything about the Mutex object sounds familiar to those of you who are native Win32
developers, that??™s because the underlying mechanism is the Win32 Mutex object. In fact, you
can get your hands on the actual OS handle via the SafeWaitHandle property inherited from the
WaitHandle base class.
Pages:
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491