Win32::Mutex - Use Win32 mutex objects from Perl

- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION

- Methods
- Deprecated Functions and Methods

- DIAGNOSTICS
- CONFIGURATION AND ENVIRONMENT
- DEPENDENCIES
- INCOMPATIBILITIES
- BUGS AND LIMITATIONS
- AUTHOR
- LICENSE AND COPYRIGHT
- DISCLAIMER OF WARRANTY

# NAME

Win32::Mutex - Use Win32 mutex objects from Perl

Back to Top

# VERSION

This document describes version 1.07 of Win32::Mutex, released April 16, 2008 as part of Win32-IPC version 1.07.

Back to Top

# SYNOPSIS

            require Win32::Mutex;

            $mutex = Win32::Mutex->new($initial,$name);
            $mutex->wait;

Back to Top

# DESCRIPTION

This module allows access to the Win32 mutex objects. The `wait` method and `wait_all` & `wait_any` functions are inherited from the the Win32::IPC manpage module.

## Methods

$mutex = Win32::Mutex->new([$initial, [$name]])

  Constructor for a new mutex object. If `$initial` is true, requests immediate ownership of the mutex (default false). If `$name` is omitted or `undef`, creates an unnamed mutex object.

  If `$name` signifies an existing mutex object, then `$initial` is ignored and the object is opened. If this happens, `$^E` will be set to 183 (ERROR_ALREADY_EXISTS).

$mutex = Win32::Mutex->`open($name)`

  Constructor for opening an existing mutex object.

$mutex->release

  Release ownership of a `$mutex`. You should have obtained ownership of the mutex through `new` or one of the wait functions. Returns true if successful, or zero if it fails (additional error information can be found in `$^E`).

$mutex->`wait([$timeout])`

  Wait for ownership of `$mutex`. See the Win32::IPC manpage.

  If this thread has already obtained ownership of `$mutex`, additional calls to `wait` will always succeed. You must call `release` once for each successful call to `wait`.

## Deprecated Functions and Methods

Win32::Mutex still supports the ActiveWare syntax, but its use is deprecated.

`Create($MutObj,$Initial,$Name)`

  Use `$MutObj = Win32::Mutex->new($Initial,$Name)` instead.

`Open($MutObj,$Name)`

  Use `$MutObj = Win32::Mutex->open($Name)` instead.

$MutObj->`Release()`

  Use `$MutObj->release` instead.

Back to Top

# DIAGNOSTICS

None.

Back to Top

# CONFIGURATION AND ENVIRONMENT

Win32::Mutex requires no configuration files or environment variables.

It runs under 32-bit or 64-bit Microsoft Windows, either natively or under Cygwin.

Back to Top

# DEPENDENCIES

the Win32::IPC manpage

Back to Top

# INCOMPATIBILITIES

Prior to version 1.06, Win32::Mutex treated `undef` values differently. In version 1.06 and later, passing `undef` as the value of an optional parameter is the same as omitting that parameter. In previous versions, `undef` was interpreted as either the empty string or 0 (along with a warning about "Use of uninitialized value...").

Back to Top

# BUGS AND LIMITATIONS

No bugs have been reported.

Back to Top

# AUTHOR

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to `<bug-Win32-IPC AT rt.cpan.org>` >, or through the web interface at http://rt.cpan.org/Public/Bug/Report.html

Loosely based on the original module by ActiveWare Internet Corp., http://www.ActiveState.com

Back to Top

# LICENSE AND COPYRIGHT

Copyright 1998-2008 Christopher J. Madsen

Created: 3 Feb 1998 from the ActiveWare version (c) 1995 Microsoft Corporation. All rights reserved. Developed by ActiveWare Internet Corp., http://www.ActiveState.com

      Other modifications (c) 1997 by Gurusamy Sarathy <gsar@cpan.org>

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

Back to Top

# DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Back to Top

Win32::Mutex - Use Win32 mutex objects from Perl