start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

22.9. Win32::Mutex

This module provides access to Win32 mutex objects, which control access to common resources. The new constructor creates the mutex and determines its initial availability. It has the following syntax:

$mut = Win32::Mutex->new(init, [name]);

The first argument determines the initial status of the mutex. If init is nonzero, the calling process has immediate ownership of the mutex object. A 0 value means that the mutex is available. The second argument assigns a name to the mutex that allows this object to be referenced by others via the open function.

Another object constructor for Win32::Mutex is open:

$mut = Win32::Mutex->open(name);

This call creates a new mutex object to access an existing mutex identified by name.

The following methods can be used on Win32::Mutex objects.

release

$mut->Release(  )

Releases ownership of the mutex from the calling process, allowing anyone waiting on the mutex to take ownership.

wait

$mut->wait([timeout])

The Win32::IPC method inherited by this module. Makes the calling process wait for ownership of the mutex object for the number of milliseconds specified by timeout. If the mutex doesn't become available before the timeout, the call returns 0.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.