Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.1 KiB

  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 <[email protected]>
  11. #
  12. # Author: Christopher J. Madsen <[email protected]>
  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. $VERSION = '1.02';
  26. use Win32::IPC 1.00 '/./'; # Import everything
  27. require Exporter;
  28. require DynaLoader;
  29. @ISA = qw(Exporter DynaLoader Win32::IPC);
  30. @EXPORT_OK = qw(
  31. wait_all wait_any
  32. );
  33. bootstrap Win32::Mutex;
  34. sub Create { $_[0] = Win32::Mutex->new(@_[1..2]) }
  35. sub Open { $_[0] = Win32::Mutex->open($_[1]) }
  36. sub Release { &release }
  37. 1;
  38. __END__
  39. =head1 NAME
  40. Win32::Mutex - Use Win32 mutex objects from Perl
  41. =head1 SYNOPSIS
  42. require Win32::Mutex;
  43. $mutex = Win32::Mutex->new($initial,$name);
  44. $mutex->wait;
  45. =head1 DESCRIPTION
  46. This module allows access to the Win32 mutex objects. The C<wait>
  47. method and C<wait_all> & C<wait_any> functions are inherited from the
  48. L<"Win32::IPC"> module.
  49. =head2 Methods
  50. =over 4
  51. =item $mutex = Win32::Mutex->new([$initial, [$name]])
  52. Constructor for a new mutex object. If C<$initial> is true, requests
  53. immediate ownership of the mutex (default false). If C<$name> is
  54. omitted, creates an unnamed mutex object.
  55. If C<$name> signifies an existing mutex object, then C<$initial> is
  56. ignored and the object is opened.
  57. =item $mutex = Win32::Mutex->open($name)
  58. Constructor for opening an existing mutex object.
  59. =item $mutex->release
  60. Release ownership of a C<$mutex>. You should have obtained ownership
  61. of the mutex through C<new> or one of the wait functions. Returns
  62. true if successful.
  63. =item $mutex->wait([$timeout])
  64. Wait for ownership of C<$mutex>. See L<"Win32::IPC">.
  65. =back
  66. =head2 Deprecated Functions and Methods
  67. B<Win32::Mutex> still supports the ActiveWare syntax, but its use is
  68. deprecated.
  69. =over 4
  70. =item Create($MutObj,$Initial,$Name)
  71. Use C<$MutObj = Win32::Mutex-E<gt>new($Initial,$Name)> instead.
  72. =item Open($MutObj,$Name)
  73. Use C<$MutObj = Win32::Mutex-E<gt>open($Name)> instead.
  74. =item $MutObj->Release()
  75. Use C<$MutObj-E<gt>release> instead.
  76. =back
  77. =head1 AUTHOR
  78. Christopher J. Madsen E<lt>F<[email protected]>E<gt>
  79. Loosely based on the original module by ActiveWare Internet Corp.,
  80. F<http://www.ActiveWare.com>
  81. =cut
  82. # Local Variables:
  83. # tmtrack-file-task: "Win32::Mutex"
  84. # End: