home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _8ab4ae6b28863ad6fa473d37418e4097 < prev    next >
Text File  |  2004-06-01  |  3KB  |  125 lines

  1. #---------------------------------------------------------------------
  2. package Win32::Mutex;
  3. #
  4. # Copyright 1998 Christopher J. Madsen
  5. #
  6. # Created: 3 Feb 1998 from the ActiveWare version
  7. #   (c) 1995 Microsoft Corporation. All rights reserved.
  8. #       Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
  9. #
  10. #   Other modifications (c) 1997 by Gurusamy Sarathy <gsar@activestate.com>
  11. #
  12. # Author: Christopher J. Madsen <chris_madsen@geocities.com>
  13. # Version: 1.00 (6-Feb-1998)
  14. #
  15. # This program is free software; you can redistribute it and/or modify
  16. # it under the same terms as Perl itself.
  17. #
  18. # This program is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
  21. # GNU General Public License or the Artistic License for more details.
  22. #
  23. # Use Win32 mutex objects for synchronization
  24. #---------------------------------------------------------------------
  25.  
  26. $VERSION = '1.02';
  27.  
  28. use Win32::IPC 1.00 '/./';      # Import everything
  29. require Exporter;
  30. require DynaLoader;
  31.  
  32. @ISA = qw(Exporter DynaLoader Win32::IPC);
  33. @EXPORT_OK = qw(
  34.   wait_all wait_any
  35. );
  36.  
  37. bootstrap Win32::Mutex;
  38.  
  39. sub Create  { $_[0] = Win32::Mutex->new(@_[1..2]) }
  40. sub Open  { $_[0] = Win32::Mutex->open($_[1]) }
  41. sub Release { &release }
  42.  
  43. 1;
  44. __END__
  45.  
  46. =head1 NAME
  47.  
  48. Win32::Mutex - Use Win32 mutex objects from Perl
  49.  
  50. =head1 SYNOPSIS
  51.  
  52.     require Win32::Mutex;
  53.  
  54.     $mutex = Win32::Mutex->new($initial,$name);
  55.     $mutex->wait;
  56.  
  57. =head1 DESCRIPTION
  58.  
  59. This module allows access to the Win32 mutex objects.  The C<wait>
  60. method and C<wait_all> & C<wait_any> functions are inherited from the
  61. L<"Win32::IPC"> module.
  62.  
  63. =head2 Methods
  64.  
  65. =over 4
  66.  
  67. =item $mutex = Win32::Mutex->new([$initial, [$name]])
  68.  
  69. Constructor for a new mutex object.  If C<$initial> is true, requests
  70. immediate ownership of the mutex (default false).  If C<$name> is
  71. omitted, creates an unnamed mutex object.
  72.  
  73. If C<$name> signifies an existing mutex object, then C<$initial> is
  74. ignored and the object is opened.
  75.  
  76. =item $mutex = Win32::Mutex->open($name)
  77.  
  78. Constructor for opening an existing mutex object.
  79.  
  80. =item $mutex->release
  81.  
  82. Release ownership of a C<$mutex>.  You should have obtained ownership
  83. of the mutex through C<new> or one of the wait functions.  Returns
  84. true if successful.
  85.  
  86. =item $mutex->wait([$timeout])
  87.  
  88. Wait for ownership of C<$mutex>.  See L<"Win32::IPC">.
  89.  
  90. =back
  91.  
  92. =head2 Deprecated Functions and Methods
  93.  
  94. B<Win32::Mutex> still supports the ActiveWare syntax, but its use is
  95. deprecated.
  96.  
  97. =over 4
  98.  
  99. =item Create($MutObj,$Initial,$Name)
  100.  
  101. Use C<$MutObj = Win32::Mutex-E<gt>new($Initial,$Name)> instead.
  102.  
  103. =item Open($MutObj,$Name)
  104.  
  105. Use C<$MutObj = Win32::Mutex-E<gt>open($Name)> instead.
  106.  
  107. =item $MutObj->Release()
  108.  
  109. Use C<$MutObj-E<gt>release> instead.
  110.  
  111. =back
  112.  
  113. =head1 AUTHOR
  114.  
  115. Christopher J. Madsen E<lt>F<chris_madsen@geocities.com>E<gt>
  116.  
  117. Loosely based on the original module by ActiveWare Internet Corp.,
  118. F<http://www.ActiveWare.com>
  119.  
  120. =cut
  121.  
  122. # Local Variables:
  123. # tmtrack-file-task: "Win32::Mutex"
  124. # End:
  125.