win32-semaphore 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +66 -59
- data/MANIFEST +10 -8
- data/README +55 -57
- data/Rakefile +33 -36
- data/certs/djberg96_pub.pem +21 -0
- data/examples/example_semaphore.rb +39 -39
- data/lib/win32-semaphore.rb +1 -0
- data/lib/win32/semaphore.rb +167 -165
- data/test/test_win32_semaphore.rb +126 -126
- data/win32-semaphore.gemspec +29 -29
- metadata +42 -13
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c68f8fb2fc2287ed58d227b07c37980aa608d1f9
|
4
|
+
data.tar.gz: 726ec74da679318c6d63dc24ea34392d0d81c064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4cbbd8ea7d4075698afec1cac1b0b31b6f3cef10e60e0694ac9e63f3cf9bfe6fd14e45c0ee418a0507757f30ccd7c34a8c441c4ab18c1139603aca7992851ce
|
7
|
+
data.tar.gz: 0f1a77a05ad27d8118253fe1b2f2699979b8fd3a4d6b51199541dc5582febdcc6e20c91276cb24f87bbd4759569f145c0afa36045190e7a0a9d0eb0a5f16d3e9
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGES
CHANGED
@@ -1,59 +1,66 @@
|
|
1
|
-
== 0.4.
|
2
|
-
* Fixed the
|
3
|
-
*
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
|
16
|
-
|
17
|
-
== 0.
|
18
|
-
*
|
19
|
-
*
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
*
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
*
|
30
|
-
*
|
31
|
-
|
32
|
-
*
|
33
|
-
|
34
|
-
|
35
|
-
*
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
*
|
40
|
-
|
41
|
-
*
|
42
|
-
* Removed the semaphore.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
*
|
54
|
-
|
55
|
-
*
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
1
|
+
== 0.4.3 - 23-Nov-2015
|
2
|
+
* Fixed the function prototype for OpenSemaphore and made corresponding changes.
|
3
|
+
* The gem is now signed.
|
4
|
+
* Added a win32-semaphore.rb file for convenience.
|
5
|
+
* The gem related tasks in the gemspec now assume Rubygems 2.x.
|
6
|
+
* Added certs to the gemspec and removed references to rubyforge_project.
|
7
|
+
|
8
|
+
== 0.4.2 - 21-Oct-2013
|
9
|
+
* Fixed the INVALID_HANDLE_VALUE constant for 64-bit Ruby.
|
10
|
+
* Added Rake as a development dependency.
|
11
|
+
* Fixed gem:create task for Rubygems 2.
|
12
|
+
|
13
|
+
== 0.4.1 - 10-Apr-2013
|
14
|
+
* Fixed the HANDLE type in the underlying FFI code. This affects
|
15
|
+
64 bit versions of Ruby.
|
16
|
+
|
17
|
+
== 0.4.0 - 10-Jul-2012
|
18
|
+
* Converted source to use FFI.
|
19
|
+
* Refactored tests.
|
20
|
+
* Now requires Ruby 1.9 or later.
|
21
|
+
* Removed the Error class. Now uses SystemCallError (Errno::) internally if
|
22
|
+
a Windows function fails.
|
23
|
+
|
24
|
+
== 0.3.2 - 23-Mar-2012
|
25
|
+
* Refactored the Rakefile and cleaned up the gemspec.
|
26
|
+
* Removed one test that was originally designed for the C version.
|
27
|
+
|
28
|
+
== 0.3.1 - 11-Aug-2009
|
29
|
+
* Changed license to Artistic 2.0.
|
30
|
+
* The Semaphore.open method is now slightly more robust.
|
31
|
+
* Renamed the test and example files.
|
32
|
+
* Some gemspec updates, including license and description.
|
33
|
+
|
34
|
+
== 0.3.0 - 3-May-2007
|
35
|
+
* Now pure Ruby.
|
36
|
+
* Added a Rakefile, with test, install and example tasks.
|
37
|
+
* Both the Semaphore.new and Semaphore.open methods now accept a block, and
|
38
|
+
automatically close the associated handle at the end of the block.
|
39
|
+
* The Semaphore.new method now accepts an optional fourth argument that
|
40
|
+
controls whether the Event object can be inherited by other processes.
|
41
|
+
* Added a gemspec.
|
42
|
+
* Removed the doc/semaphore.txt file. The documentation is now inlined via
|
43
|
+
RDoc. There is also some documentation in the README file.
|
44
|
+
|
45
|
+
== 0.2.2 - 10-Jun-2005
|
46
|
+
* Now Unicode friendly.
|
47
|
+
* Inlined rdoc documentation into the C source code.
|
48
|
+
* Made the semaphore.txt file rdoc friendly.
|
49
|
+
* Removed the semaphore.rd file.
|
50
|
+
|
51
|
+
== 0.2.1 - 1-Mar-2005
|
52
|
+
* Added a VERSION constant (oops).
|
53
|
+
* Moved the 'examples' directory to the toplevel directory.
|
54
|
+
* Made the CHANGES and README files rdoc friendly.
|
55
|
+
* Removed an unused (and unnecessary) helper function in semaphore.h.
|
56
|
+
|
57
|
+
== 0.2.0 - 16-Jul-2004
|
58
|
+
* Modified to use the newer allocation framework. This means that as of this
|
59
|
+
release, this package requires Ruby 1.8.0 or later.
|
60
|
+
* Fixed a bug in the constructor where it was possible for the constructor to
|
61
|
+
fail, but have no error raised.
|
62
|
+
* Moved the test.rb file to the doc/examples directory.
|
63
|
+
* Added more tests.
|
64
|
+
|
65
|
+
== 0.1.0 - 14-May-2004
|
66
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-semaphore.gemspec
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-semaphore.gemspec
|
6
|
+
* certs/djberg96_pub.pem
|
7
|
+
* examples/example_semaphore.rb
|
8
|
+
* lib/win32-semaphore.rb
|
9
|
+
* lib/win32/semaphore.rb
|
10
|
+
* test/test_win32_semaphore.rb
|
data/README
CHANGED
@@ -1,57 +1,55 @@
|
|
1
|
-
== Brief Description
|
2
|
-
An interface for MS Windows Semaphores.
|
3
|
-
|
4
|
-
== Prerequisites
|
5
|
-
win32-ipc 0.6.0 or later.
|
6
|
-
|
7
|
-
== Installation
|
8
|
-
gem install win32-semaphore
|
9
|
-
|
10
|
-
== Synopsis
|
11
|
-
require 'win32/semaphore'
|
12
|
-
include Win32
|
13
|
-
|
14
|
-
Semaphore.new(1, 5, 'test') do |sem|
|
15
|
-
puts 'uh, oh' unless sem.wait(10) > 0
|
16
|
-
sem.release(2) # 2
|
17
|
-
end
|
18
|
-
|
19
|
-
== Documentation
|
20
|
-
The semaphore.rb file contains inline RDoc documentation. If you installed
|
21
|
-
this file as a gem, then you have the docs.
|
22
|
-
|
23
|
-
For more detailed documentation about Semaphores on MS Windows in general,
|
24
|
-
please visit http://www.msdn.com/library and lookup the CreateSemaphore(),
|
25
|
-
OpenSemaphore() and ReleaseSemaphore() functions.
|
26
|
-
|
27
|
-
== Notes
|
28
|
-
The Semaphore class is a subclass of Win32::Ipc
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Daniel J. Berger
|
57
|
-
Park Heesob
|
1
|
+
== Brief Description
|
2
|
+
An interface for MS Windows Semaphores.
|
3
|
+
|
4
|
+
== Prerequisites
|
5
|
+
win32-ipc 0.6.0 or later.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
gem install win32-semaphore
|
9
|
+
|
10
|
+
== Synopsis
|
11
|
+
require 'win32/semaphore'
|
12
|
+
include Win32
|
13
|
+
|
14
|
+
Semaphore.new(1, 5, 'test') do |sem|
|
15
|
+
puts 'uh, oh' unless sem.wait(10) > 0
|
16
|
+
sem.release(2) # 2
|
17
|
+
end
|
18
|
+
|
19
|
+
== Documentation
|
20
|
+
The semaphore.rb file contains inline RDoc documentation. If you installed
|
21
|
+
this file as a gem, then you have the docs.
|
22
|
+
|
23
|
+
For more detailed documentation about Semaphores on MS Windows in general,
|
24
|
+
please visit http://www.msdn.com/library and lookup the CreateSemaphore(),
|
25
|
+
OpenSemaphore() and ReleaseSemaphore() functions.
|
26
|
+
|
27
|
+
== Notes
|
28
|
+
The Win32::Semaphore class is a subclass of Win32::Ipc.
|
29
|
+
|
30
|
+
== Acknowledgements
|
31
|
+
Adapted originally from the Win32::Semaphore Perl module by Christopher
|
32
|
+
J. Madsen.
|
33
|
+
|
34
|
+
== Known Bugs
|
35
|
+
None known. Any bugs should be reported on the project page at
|
36
|
+
https://github.com/djberg96/win32-semaphore.
|
37
|
+
|
38
|
+
== Future Plans
|
39
|
+
Suggestions welcome.
|
40
|
+
|
41
|
+
== License
|
42
|
+
Artistic 2.0
|
43
|
+
|
44
|
+
== Copyright
|
45
|
+
(C) 2003-2015 Daniel J. Berger
|
46
|
+
All Rights Reserved
|
47
|
+
|
48
|
+
== Warranty
|
49
|
+
This package is provided "as is" and without any express or
|
50
|
+
implied warranties, including, without limitation, the implied
|
51
|
+
warranties of merchantability and fitness for a particular purpose.
|
52
|
+
|
53
|
+
== Authors
|
54
|
+
Daniel J. Berger
|
55
|
+
Park Heesob
|
data/Rakefile
CHANGED
@@ -1,36 +1,33 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
|
5
|
-
CLEAN.include("**/*.gem")
|
6
|
-
|
7
|
-
namespace :gem do
|
8
|
-
desc 'Create the win32-semaphore gem'
|
9
|
-
task :create => [:clean] do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
task :default => :test
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem")
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Create the win32-semaphore gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
require 'rubygems/package'
|
11
|
+
spec = eval(IO.read('win32-semaphore.gemspec'))
|
12
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
13
|
+
Gem::Package.build(spec, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Install the win32-semaphore gem'
|
17
|
+
task :install => [:create] do
|
18
|
+
file = Dir["*.gem"].first
|
19
|
+
sh "gem install -l #{file}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Run the example program'
|
24
|
+
task :example do
|
25
|
+
ruby '-Ilib examples/example_semaphore.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
Rake::TestTask.new do |t|
|
29
|
+
t.verbose = true
|
30
|
+
t.warning = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :default => :test
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
3
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
+
MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
|
5
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
|
7
|
+
Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
|
8
|
+
S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
|
9
|
+
gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
|
10
|
+
FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
|
11
|
+
zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
|
12
|
+
DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
|
13
|
+
nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
14
|
+
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
15
|
+
ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
|
16
|
+
tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
|
17
|
+
/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
|
18
|
+
wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
|
19
|
+
EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
|
20
|
+
tGSHgAmcLlkdGgan182qsE/4kKM=
|
21
|
+
-----END CERTIFICATE-----
|
@@ -1,40 +1,40 @@
|
|
1
|
-
##############################################################
|
2
|
-
# example_semaphore.rb
|
3
|
-
#
|
4
|
-
# A test script for general futzing. Modify as you see fit.
|
5
|
-
#
|
6
|
-
# Note that you can run this via the 'rake example' task.
|
7
|
-
##############################################################
|
8
|
-
require "win32/semaphore"
|
9
|
-
include Win32
|
10
|
-
|
11
|
-
test = 1
|
12
|
-
s = Semaphore.new(3,3,"test")
|
13
|
-
test += 1
|
14
|
-
puts "ok #{test}"
|
15
|
-
|
16
|
-
print 'not ' unless s.wait(10) > 0
|
17
|
-
test += 1
|
18
|
-
puts "ok #{test}"
|
19
|
-
|
20
|
-
print 'not ' unless s.wait(0) > 0
|
21
|
-
test += 1
|
22
|
-
puts "ok #{test}"
|
23
|
-
|
24
|
-
printf "If you don't see 'ok %d' immediately, you'd better hit Ctrl-C\n", test+1
|
25
|
-
print 'not ' unless s.wait > 0
|
26
|
-
test += 1
|
27
|
-
puts "ok #{test}"
|
28
|
-
|
29
|
-
print 'not ' if s.wait(0) > 0
|
30
|
-
test += 1
|
31
|
-
puts "ok #{test}"
|
32
|
-
|
33
|
-
s.release
|
34
|
-
s.release(1)
|
35
|
-
|
36
|
-
print 'not ' unless (result = s.release(1)) == 2
|
37
|
-
test += 1
|
38
|
-
puts "ok #{test}\t(result is #{result})"
|
39
|
-
|
1
|
+
##############################################################
|
2
|
+
# example_semaphore.rb
|
3
|
+
#
|
4
|
+
# A test script for general futzing. Modify as you see fit.
|
5
|
+
#
|
6
|
+
# Note that you can run this via the 'rake example' task.
|
7
|
+
##############################################################
|
8
|
+
require "win32/semaphore"
|
9
|
+
include Win32
|
10
|
+
|
11
|
+
test = 1
|
12
|
+
s = Semaphore.new(3,3,"test")
|
13
|
+
test += 1
|
14
|
+
puts "ok #{test}"
|
15
|
+
|
16
|
+
print 'not ' unless s.wait(10) > 0
|
17
|
+
test += 1
|
18
|
+
puts "ok #{test}"
|
19
|
+
|
20
|
+
print 'not ' unless s.wait(0) > 0
|
21
|
+
test += 1
|
22
|
+
puts "ok #{test}"
|
23
|
+
|
24
|
+
printf "If you don't see 'ok %d' immediately, you'd better hit Ctrl-C\n", test+1
|
25
|
+
print 'not ' unless s.wait > 0
|
26
|
+
test += 1
|
27
|
+
puts "ok #{test}"
|
28
|
+
|
29
|
+
print 'not ' if s.wait(0) > 0
|
30
|
+
test += 1
|
31
|
+
puts "ok #{test}"
|
32
|
+
|
33
|
+
s.release
|
34
|
+
s.release(1)
|
35
|
+
|
36
|
+
print 'not ' unless (result = s.release(1)) == 2
|
37
|
+
test += 1
|
38
|
+
puts "ok #{test}\t(result is #{result})"
|
39
|
+
|
40
40
|
s.close
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'win32/semaphore'
|
data/lib/win32/semaphore.rb
CHANGED
@@ -1,165 +1,167 @@
|
|
1
|
-
require 'win32/ipc'
|
2
|
-
|
3
|
-
# The Win32 module serves as a namespace only.
|
4
|
-
module Win32
|
5
|
-
|
6
|
-
# The Semaphore class encapsulates semaphore objects on Windows.
|
7
|
-
class Semaphore < Ipc
|
8
|
-
typedef :ulong, :dword
|
9
|
-
typedef :uintptr_t, :handle
|
10
|
-
|
11
|
-
ffi_lib :kernel32
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
class SecurityAttributes < FFI::Struct
|
16
|
-
layout(
|
17
|
-
:nLength, :dword,
|
18
|
-
:lpSecurityDescriptor, :pointer,
|
19
|
-
:bInheritHandle, :bool
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
attach_function :CreateSemaphoreW, [:pointer, :long, :long, :buffer_in], :handle
|
24
|
-
attach_function :OpenSemaphoreW, [:dword, :
|
25
|
-
attach_function :ReleaseSemaphore, [:handle, :long, :pointer], :bool
|
26
|
-
|
27
|
-
private_class_method :CreateSemaphoreW, :OpenSemaphoreW, :ReleaseSemaphore
|
28
|
-
|
29
|
-
SEMAPHORE_ALL_ACCESS = 0x1F0003
|
30
|
-
INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address
|
31
|
-
|
32
|
-
public
|
33
|
-
|
34
|
-
# The version of the win32-semaphore library
|
35
|
-
VERSION = '0.4.
|
36
|
-
|
37
|
-
# The initial count for the semaphore object. This value must be greater
|
38
|
-
# than or equal to zero and less than or equal to +max_count+. The state
|
39
|
-
# of a semaphore is signaled when its count is greater than zero and
|
40
|
-
# nonsignaled when it is zero. The count is decreased by one whenever
|
41
|
-
# a wait function releases a thread that was waiting for the semaphore.
|
42
|
-
# The count is increased by a specified amount by calling
|
43
|
-
# Semaphore#release method.
|
44
|
-
#
|
45
|
-
attr_reader :initial_count
|
46
|
-
|
47
|
-
# The maximum count for the semaphore object. This value must be
|
48
|
-
# greater than zero.
|
49
|
-
#
|
50
|
-
attr_reader :max_count
|
51
|
-
|
52
|
-
# The name of the Semaphore object.
|
53
|
-
#
|
54
|
-
attr_reader :name
|
55
|
-
|
56
|
-
# Creates and returns new Semaphore object. If +name+ is omitted, the
|
57
|
-
# Semaphore object is created without a name, i.e. it's anonymous.
|
58
|
-
#
|
59
|
-
# If +name+ is provided and it already exists, then it is opened
|
60
|
-
# instead, and the +initial_count+ and +max_count+ parameters are
|
61
|
-
# ignored.
|
62
|
-
#
|
63
|
-
# The +initial_count+ and +max_count+ parameters set the initial count
|
64
|
-
# and maximum count for the Semaphore object, respectively. See the
|
65
|
-
# documentation for the corresponding accessor for more information.
|
66
|
-
#
|
67
|
-
# The +inherit+ attribute determines whether or not the semaphore can
|
68
|
-
# be inherited by child processes.
|
69
|
-
#
|
70
|
-
def initialize(initial_count, max_count, name=nil, inherit=true)
|
71
|
-
@initial_count = initial_count
|
72
|
-
@max_count = max_count
|
73
|
-
@name = name
|
74
|
-
@inherit = inherit
|
75
|
-
|
76
|
-
if name && name.encoding.to_s != 'UTF-16LE'
|
77
|
-
name = name + 0.chr
|
78
|
-
name.encode!('UTF-16LE')
|
79
|
-
end
|
80
|
-
|
81
|
-
if inherit
|
82
|
-
sec = SecurityAttributes.new
|
83
|
-
sec[:nLength] = SecurityAttributes.size
|
84
|
-
sec[:bInheritHandle] = true
|
85
|
-
else
|
86
|
-
sec = nil
|
87
|
-
end
|
88
|
-
|
89
|
-
handle = CreateSemaphoreW(sec, initial_count, max_count, name)
|
90
|
-
|
91
|
-
if handle == 0 || handle == INVALID_HANDLE_VALUE
|
92
|
-
raise SystemCallError.new("CreateSemaphore", FFI.errno)
|
93
|
-
end
|
94
|
-
|
95
|
-
super(handle)
|
96
|
-
|
97
|
-
if block_given?
|
98
|
-
begin
|
99
|
-
yield self
|
100
|
-
ensure
|
101
|
-
close
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
# Open an existing Semaphore by +name+. The +inherit+ argument sets
|
107
|
-
# whether or not the object was opened such that a process created by the
|
108
|
-
# CreateProcess() function (a Windows API function) can inherit the
|
109
|
-
# handle. The default is true.
|
110
|
-
#
|
111
|
-
# This method is essentially identical to Semaphore.new, except that the
|
112
|
-
# options for +initial_count+ and +max_count+ cannot be set (since they
|
113
|
-
# are already set). Also, this method will raise a Semaphore::Error if
|
114
|
-
# the semaphore doesn't already exist.
|
115
|
-
#
|
116
|
-
# If you want "open or create" semantics, then use Semaphore.new.
|
117
|
-
#
|
118
|
-
def self.open(name, inherit=true, &block)
|
119
|
-
if name && name.encoding.to_s != 'UTF-16LE'
|
120
|
-
name = name + 0.chr
|
121
|
-
name.encode!('UTF-16LE')
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
#
|
160
|
-
#
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
end
|
1
|
+
require 'win32/ipc'
|
2
|
+
|
3
|
+
# The Win32 module serves as a namespace only.
|
4
|
+
module Win32
|
5
|
+
|
6
|
+
# The Semaphore class encapsulates semaphore objects on Windows.
|
7
|
+
class Semaphore < Ipc
|
8
|
+
typedef :ulong, :dword
|
9
|
+
typedef :uintptr_t, :handle
|
10
|
+
|
11
|
+
ffi_lib :kernel32
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
class SecurityAttributes < FFI::Struct
|
16
|
+
layout(
|
17
|
+
:nLength, :dword,
|
18
|
+
:lpSecurityDescriptor, :pointer,
|
19
|
+
:bInheritHandle, :bool
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
attach_function :CreateSemaphoreW, [:pointer, :long, :long, :buffer_in], :handle
|
24
|
+
attach_function :OpenSemaphoreW, [:dword, :int, :buffer_in], :handle
|
25
|
+
attach_function :ReleaseSemaphore, [:handle, :long, :pointer], :bool
|
26
|
+
|
27
|
+
private_class_method :CreateSemaphoreW, :OpenSemaphoreW, :ReleaseSemaphore
|
28
|
+
|
29
|
+
SEMAPHORE_ALL_ACCESS = 0x1F0003
|
30
|
+
INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address
|
31
|
+
|
32
|
+
public
|
33
|
+
|
34
|
+
# The version of the win32-semaphore library
|
35
|
+
VERSION = '0.4.3'
|
36
|
+
|
37
|
+
# The initial count for the semaphore object. This value must be greater
|
38
|
+
# than or equal to zero and less than or equal to +max_count+. The state
|
39
|
+
# of a semaphore is signaled when its count is greater than zero and
|
40
|
+
# nonsignaled when it is zero. The count is decreased by one whenever
|
41
|
+
# a wait function releases a thread that was waiting for the semaphore.
|
42
|
+
# The count is increased by a specified amount by calling
|
43
|
+
# Semaphore#release method.
|
44
|
+
#
|
45
|
+
attr_reader :initial_count
|
46
|
+
|
47
|
+
# The maximum count for the semaphore object. This value must be
|
48
|
+
# greater than zero.
|
49
|
+
#
|
50
|
+
attr_reader :max_count
|
51
|
+
|
52
|
+
# The name of the Semaphore object.
|
53
|
+
#
|
54
|
+
attr_reader :name
|
55
|
+
|
56
|
+
# Creates and returns new Semaphore object. If +name+ is omitted, the
|
57
|
+
# Semaphore object is created without a name, i.e. it's anonymous.
|
58
|
+
#
|
59
|
+
# If +name+ is provided and it already exists, then it is opened
|
60
|
+
# instead, and the +initial_count+ and +max_count+ parameters are
|
61
|
+
# ignored.
|
62
|
+
#
|
63
|
+
# The +initial_count+ and +max_count+ parameters set the initial count
|
64
|
+
# and maximum count for the Semaphore object, respectively. See the
|
65
|
+
# documentation for the corresponding accessor for more information.
|
66
|
+
#
|
67
|
+
# The +inherit+ attribute determines whether or not the semaphore can
|
68
|
+
# be inherited by child processes.
|
69
|
+
#
|
70
|
+
def initialize(initial_count, max_count, name=nil, inherit=true)
|
71
|
+
@initial_count = initial_count
|
72
|
+
@max_count = max_count
|
73
|
+
@name = name
|
74
|
+
@inherit = inherit
|
75
|
+
|
76
|
+
if name && name.encoding.to_s != 'UTF-16LE'
|
77
|
+
name = name + 0.chr
|
78
|
+
name.encode!('UTF-16LE')
|
79
|
+
end
|
80
|
+
|
81
|
+
if inherit
|
82
|
+
sec = SecurityAttributes.new
|
83
|
+
sec[:nLength] = SecurityAttributes.size
|
84
|
+
sec[:bInheritHandle] = true
|
85
|
+
else
|
86
|
+
sec = nil
|
87
|
+
end
|
88
|
+
|
89
|
+
handle = CreateSemaphoreW(sec, initial_count, max_count, name)
|
90
|
+
|
91
|
+
if handle == 0 || handle == INVALID_HANDLE_VALUE
|
92
|
+
raise SystemCallError.new("CreateSemaphore", FFI.errno)
|
93
|
+
end
|
94
|
+
|
95
|
+
super(handle)
|
96
|
+
|
97
|
+
if block_given?
|
98
|
+
begin
|
99
|
+
yield self
|
100
|
+
ensure
|
101
|
+
close
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Open an existing Semaphore by +name+. The +inherit+ argument sets
|
107
|
+
# whether or not the object was opened such that a process created by the
|
108
|
+
# CreateProcess() function (a Windows API function) can inherit the
|
109
|
+
# handle. The default is true.
|
110
|
+
#
|
111
|
+
# This method is essentially identical to Semaphore.new, except that the
|
112
|
+
# options for +initial_count+ and +max_count+ cannot be set (since they
|
113
|
+
# are already set). Also, this method will raise a Semaphore::Error if
|
114
|
+
# the semaphore doesn't already exist.
|
115
|
+
#
|
116
|
+
# If you want "open or create" semantics, then use Semaphore.new.
|
117
|
+
#
|
118
|
+
def self.open(name, inherit=true, &block)
|
119
|
+
if name && name.encoding.to_s != 'UTF-16LE'
|
120
|
+
name = name + 0.chr
|
121
|
+
name.encode!('UTF-16LE')
|
122
|
+
end
|
123
|
+
|
124
|
+
inherit = inherit ? 1 : 0
|
125
|
+
|
126
|
+
begin
|
127
|
+
# The OpenSemaphore() call here is strictly to force an error if the
|
128
|
+
# user tries to open a semaphore that doesn't already exist.
|
129
|
+
handle = OpenSemaphoreW(SEMAPHORE_ALL_ACCESS, inherit, name)
|
130
|
+
|
131
|
+
if handle == 0 || handle == INVALID_HANDLE_VALUE
|
132
|
+
raise SystemCallError.new("OpenSemaphore", FFI.errno)
|
133
|
+
end
|
134
|
+
ensure
|
135
|
+
CloseHandle(handle)
|
136
|
+
end
|
137
|
+
|
138
|
+
self.new(0, 1, name, inherit, &block)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Increases the count of the specified semaphore object by +amount+.
|
142
|
+
# The default is 1. Returns the previous count of the semaphore if
|
143
|
+
# successful. If the +amount+ exceeds the +max_count+ specified when
|
144
|
+
# the semaphore was created then an error is raised.
|
145
|
+
#
|
146
|
+
def release(amount = 1)
|
147
|
+
pcount = FFI::MemoryPointer.new(:long)
|
148
|
+
|
149
|
+
# Ruby doesn't translate error 298, so we treat it as an EINVAL
|
150
|
+
unless ReleaseSemaphore(@handle, amount, pcount)
|
151
|
+
errno = FFI.errno
|
152
|
+
errno = 22 if errno == 298 # 22 is EINVAL
|
153
|
+
raise SystemCallError.new("ReleaseSemaphore", errno)
|
154
|
+
end
|
155
|
+
|
156
|
+
pcount.read_long
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns whether or not the object was opened such that a process
|
160
|
+
# created by the CreateProcess() function (a Windows API function) can
|
161
|
+
# inherit the handle. The default is true.
|
162
|
+
#
|
163
|
+
def inheritable?
|
164
|
+
@inherit
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -1,126 +1,126 @@
|
|
1
|
-
################################################################
|
2
|
-
# test_win32_semaphore.rb
|
3
|
-
#
|
4
|
-
# Test suite for the win32-semaphore package. This test should
|
5
|
-
# be run via the 'rake test' task.
|
6
|
-
################################################################
|
7
|
-
require 'win32/semaphore'
|
8
|
-
require 'test-unit'
|
9
|
-
include Win32
|
10
|
-
|
11
|
-
class TC_Semaphore < Test::Unit::TestCase
|
12
|
-
def setup
|
13
|
-
@sem = Semaphore.new(1, 3, 'test')
|
14
|
-
end
|
15
|
-
|
16
|
-
test "version is set to expected value" do
|
17
|
-
assert_equal('0.4.
|
18
|
-
end
|
19
|
-
|
20
|
-
test "initial_count basic functionality" do
|
21
|
-
assert_respond_to(@sem, :initial_count)
|
22
|
-
end
|
23
|
-
|
24
|
-
test "initial count is set to value passed to constructor" do
|
25
|
-
assert_equal(1, @sem.initial_count)
|
26
|
-
end
|
27
|
-
|
28
|
-
test "max_count basic functionality" do
|
29
|
-
assert_respond_to(@sem, :max_count)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "max_count is set to value passed to constructor" do
|
33
|
-
assert_equal(3, @sem.max_count)
|
34
|
-
end
|
35
|
-
|
36
|
-
test "name method basic functionality" do
|
37
|
-
assert_respond_to(@sem, :name)
|
38
|
-
end
|
39
|
-
|
40
|
-
test "name returns value passed in constructor" do
|
41
|
-
assert_equal('test', @sem.name)
|
42
|
-
end
|
43
|
-
|
44
|
-
test "default name is nil" do
|
45
|
-
sem = Semaphore.new(0,1)
|
46
|
-
assert_nil(sem.name)
|
47
|
-
sem.close
|
48
|
-
end
|
49
|
-
|
50
|
-
test "inheritable? method is defined and true by default" do
|
51
|
-
assert_respond_to(@sem, :inheritable?)
|
52
|
-
assert_true(@sem.inheritable?)
|
53
|
-
end
|
54
|
-
|
55
|
-
test "inheritable? method returns value passed to constructor" do
|
56
|
-
sem = Semaphore.new(0,1,nil,false)
|
57
|
-
assert_false(sem.inheritable?)
|
58
|
-
sem.close
|
59
|
-
end
|
60
|
-
|
61
|
-
test "release method basic functionality" do
|
62
|
-
assert_respond_to(@sem, :release)
|
63
|
-
assert_kind_of(Fixnum, @sem.release)
|
64
|
-
end
|
65
|
-
|
66
|
-
test "release accepts an optional amount" do
|
67
|
-
assert_equal(1, @sem.release(1))
|
68
|
-
end
|
69
|
-
|
70
|
-
test "release returns the total number of releases" do
|
71
|
-
assert_equal(1, @sem.release(1))
|
72
|
-
assert_equal(2, @sem.release(1))
|
73
|
-
end
|
74
|
-
|
75
|
-
test "attempting to release more than the total count raises an error" do
|
76
|
-
assert_raise(Errno::EINVAL){ @sem.release(99) }
|
77
|
-
end
|
78
|
-
|
79
|
-
test "release only accepts one argument" do
|
80
|
-
assert_raise(ArgumentError){ @sem.release(1,2) }
|
81
|
-
end
|
82
|
-
|
83
|
-
test "open method basic functionality" do
|
84
|
-
assert_respond_to(Semaphore, :open)
|
85
|
-
assert_nothing_raised{ Semaphore.open('test'){} }
|
86
|
-
end
|
87
|
-
|
88
|
-
test "open method fails is semaphore name is invalid" do
|
89
|
-
assert_raise(Errno::ENOENT){ Semaphore.open('bogus'){} }
|
90
|
-
end
|
91
|
-
|
92
|
-
test "wait method was inherited" do
|
93
|
-
assert_respond_to(@sem, :wait)
|
94
|
-
end
|
95
|
-
|
96
|
-
test "wait_any method was inherited" do
|
97
|
-
assert_respond_to(@sem, :wait_any)
|
98
|
-
end
|
99
|
-
|
100
|
-
test "wait_all method was inherited" do
|
101
|
-
assert_respond_to(@sem, :wait_all)
|
102
|
-
end
|
103
|
-
|
104
|
-
test "first argument to constructor must be a number" do
|
105
|
-
assert_raise(TypeError){ Semaphore.new('foo', 1){} }
|
106
|
-
end
|
107
|
-
|
108
|
-
test "second argument to constructor must be a number" do
|
109
|
-
assert_raise(TypeError){ Semaphore.new(1, 'bar'){} }
|
110
|
-
end
|
111
|
-
|
112
|
-
test "constructor accepts a maximum of four arguments" do
|
113
|
-
assert_raise(ArgumentError){ Semaphore.new(1, 2, 'test', true, 1){} }
|
114
|
-
end
|
115
|
-
|
116
|
-
test "ffi functions are private" do
|
117
|
-
assert_not_respond_to(Semaphore, :CreateSemaphoreW)
|
118
|
-
assert_not_respond_to(Semaphore, :OpenSemaphoreW)
|
119
|
-
assert_not_respond_to(Semaphore, :ReleaseSemaphore)
|
120
|
-
end
|
121
|
-
|
122
|
-
def teardown
|
123
|
-
@sem.close if @sem
|
124
|
-
@sem = nil
|
125
|
-
end
|
126
|
-
end
|
1
|
+
################################################################
|
2
|
+
# test_win32_semaphore.rb
|
3
|
+
#
|
4
|
+
# Test suite for the win32-semaphore package. This test should
|
5
|
+
# be run via the 'rake test' task.
|
6
|
+
################################################################
|
7
|
+
require 'win32/semaphore'
|
8
|
+
require 'test-unit'
|
9
|
+
include Win32
|
10
|
+
|
11
|
+
class TC_Semaphore < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@sem = Semaphore.new(1, 3, 'test')
|
14
|
+
end
|
15
|
+
|
16
|
+
test "version is set to expected value" do
|
17
|
+
assert_equal('0.4.3', Semaphore::VERSION)
|
18
|
+
end
|
19
|
+
|
20
|
+
test "initial_count basic functionality" do
|
21
|
+
assert_respond_to(@sem, :initial_count)
|
22
|
+
end
|
23
|
+
|
24
|
+
test "initial count is set to value passed to constructor" do
|
25
|
+
assert_equal(1, @sem.initial_count)
|
26
|
+
end
|
27
|
+
|
28
|
+
test "max_count basic functionality" do
|
29
|
+
assert_respond_to(@sem, :max_count)
|
30
|
+
end
|
31
|
+
|
32
|
+
test "max_count is set to value passed to constructor" do
|
33
|
+
assert_equal(3, @sem.max_count)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "name method basic functionality" do
|
37
|
+
assert_respond_to(@sem, :name)
|
38
|
+
end
|
39
|
+
|
40
|
+
test "name returns value passed in constructor" do
|
41
|
+
assert_equal('test', @sem.name)
|
42
|
+
end
|
43
|
+
|
44
|
+
test "default name is nil" do
|
45
|
+
sem = Semaphore.new(0,1)
|
46
|
+
assert_nil(sem.name)
|
47
|
+
sem.close
|
48
|
+
end
|
49
|
+
|
50
|
+
test "inheritable? method is defined and true by default" do
|
51
|
+
assert_respond_to(@sem, :inheritable?)
|
52
|
+
assert_true(@sem.inheritable?)
|
53
|
+
end
|
54
|
+
|
55
|
+
test "inheritable? method returns value passed to constructor" do
|
56
|
+
sem = Semaphore.new(0,1,nil,false)
|
57
|
+
assert_false(sem.inheritable?)
|
58
|
+
sem.close
|
59
|
+
end
|
60
|
+
|
61
|
+
test "release method basic functionality" do
|
62
|
+
assert_respond_to(@sem, :release)
|
63
|
+
assert_kind_of(Fixnum, @sem.release)
|
64
|
+
end
|
65
|
+
|
66
|
+
test "release accepts an optional amount" do
|
67
|
+
assert_equal(1, @sem.release(1))
|
68
|
+
end
|
69
|
+
|
70
|
+
test "release returns the total number of releases" do
|
71
|
+
assert_equal(1, @sem.release(1))
|
72
|
+
assert_equal(2, @sem.release(1))
|
73
|
+
end
|
74
|
+
|
75
|
+
test "attempting to release more than the total count raises an error" do
|
76
|
+
assert_raise(Errno::EINVAL){ @sem.release(99) }
|
77
|
+
end
|
78
|
+
|
79
|
+
test "release only accepts one argument" do
|
80
|
+
assert_raise(ArgumentError){ @sem.release(1,2) }
|
81
|
+
end
|
82
|
+
|
83
|
+
test "open method basic functionality" do
|
84
|
+
assert_respond_to(Semaphore, :open)
|
85
|
+
assert_nothing_raised{ Semaphore.open('test'){} }
|
86
|
+
end
|
87
|
+
|
88
|
+
test "open method fails is semaphore name is invalid" do
|
89
|
+
assert_raise(Errno::ENOENT){ Semaphore.open('bogus'){} }
|
90
|
+
end
|
91
|
+
|
92
|
+
test "wait method was inherited" do
|
93
|
+
assert_respond_to(@sem, :wait)
|
94
|
+
end
|
95
|
+
|
96
|
+
test "wait_any method was inherited" do
|
97
|
+
assert_respond_to(@sem, :wait_any)
|
98
|
+
end
|
99
|
+
|
100
|
+
test "wait_all method was inherited" do
|
101
|
+
assert_respond_to(@sem, :wait_all)
|
102
|
+
end
|
103
|
+
|
104
|
+
test "first argument to constructor must be a number" do
|
105
|
+
assert_raise(TypeError){ Semaphore.new('foo', 1){} }
|
106
|
+
end
|
107
|
+
|
108
|
+
test "second argument to constructor must be a number" do
|
109
|
+
assert_raise(TypeError){ Semaphore.new(1, 'bar'){} }
|
110
|
+
end
|
111
|
+
|
112
|
+
test "constructor accepts a maximum of four arguments" do
|
113
|
+
assert_raise(ArgumentError){ Semaphore.new(1, 2, 'test', true, 1){} }
|
114
|
+
end
|
115
|
+
|
116
|
+
test "ffi functions are private" do
|
117
|
+
assert_not_respond_to(Semaphore, :CreateSemaphoreW)
|
118
|
+
assert_not_respond_to(Semaphore, :OpenSemaphoreW)
|
119
|
+
assert_not_respond_to(Semaphore, :ReleaseSemaphore)
|
120
|
+
end
|
121
|
+
|
122
|
+
def teardown
|
123
|
+
@sem.close if @sem
|
124
|
+
@sem = nil
|
125
|
+
end
|
126
|
+
end
|
data/win32-semaphore.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'win32-semaphore'
|
5
|
-
spec.version = '0.4.
|
6
|
-
spec.author = 'Daniel J. Berger'
|
7
|
-
spec.license = 'Artistic 2.0'
|
8
|
-
spec.email = 'djberg96@gmail.com'
|
9
|
-
spec.homepage = 'http://www.github.com/djberg96/win32-semaphore'
|
10
|
-
spec.summary = 'Interface to MS Windows Semaphore objects.'
|
11
|
-
spec.test_file = 'test/test_win32_semaphore.rb'
|
12
|
-
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
-
|
14
|
-
|
15
|
-
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
|
-
spec.required_ruby_version = '> 1.9.0'
|
17
|
-
|
18
|
-
spec.add_dependency('win32-ipc')
|
19
|
-
|
20
|
-
spec.add_development_dependency('rake')
|
21
|
-
spec.add_development_dependency('test-unit')
|
22
|
-
|
23
|
-
spec.description = <<-EOF
|
24
|
-
The win32-semaphore library provides an interface to semaphore objects
|
25
|
-
on MS Windows. A semaphore is a kernel object used for resource counting.
|
26
|
-
This allows threads to query the number of resources available, and wait
|
27
|
-
if there aren't any available.
|
28
|
-
EOF
|
29
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'win32-semaphore'
|
5
|
+
spec.version = '0.4.3'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.license = 'Artistic 2.0'
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
9
|
+
spec.homepage = 'http://www.github.com/djberg96/win32-semaphore'
|
10
|
+
spec.summary = 'Interface to MS Windows Semaphore objects.'
|
11
|
+
spec.test_file = 'test/test_win32_semaphore.rb'
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
+
spec.cert_chain = Dir['certs/*']
|
14
|
+
|
15
|
+
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
|
+
spec.required_ruby_version = '> 1.9.0'
|
17
|
+
|
18
|
+
spec.add_dependency('win32-ipc')
|
19
|
+
|
20
|
+
spec.add_development_dependency('rake')
|
21
|
+
spec.add_development_dependency('test-unit')
|
22
|
+
|
23
|
+
spec.description = <<-EOF
|
24
|
+
The win32-semaphore library provides an interface to semaphore objects
|
25
|
+
on MS Windows. A semaphore is a kernel object used for resource counting.
|
26
|
+
This allows threads to query the number of resources available, and wait
|
27
|
+
if there aren't any available.
|
28
|
+
EOF
|
29
|
+
end
|
metadata
CHANGED
@@ -1,55 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-semaphore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
14
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
15
|
+
MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
|
16
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
|
18
|
+
Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
|
19
|
+
S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
|
20
|
+
gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
|
21
|
+
FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
|
22
|
+
zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
|
23
|
+
DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
|
24
|
+
nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
25
|
+
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
26
|
+
ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
|
27
|
+
tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
|
28
|
+
/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
|
29
|
+
wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
|
30
|
+
EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
|
31
|
+
tGSHgAmcLlkdGgan182qsE/4kKM=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
34
|
dependencies:
|
13
35
|
- !ruby/object:Gem::Dependency
|
14
36
|
name: win32-ipc
|
15
37
|
requirement: !ruby/object:Gem::Requirement
|
16
38
|
requirements:
|
17
|
-
- -
|
39
|
+
- - ">="
|
18
40
|
- !ruby/object:Gem::Version
|
19
41
|
version: '0'
|
20
42
|
type: :runtime
|
21
43
|
prerelease: false
|
22
44
|
version_requirements: !ruby/object:Gem::Requirement
|
23
45
|
requirements:
|
24
|
-
- -
|
46
|
+
- - ">="
|
25
47
|
- !ruby/object:Gem::Version
|
26
48
|
version: '0'
|
27
49
|
- !ruby/object:Gem::Dependency
|
28
50
|
name: rake
|
29
51
|
requirement: !ruby/object:Gem::Requirement
|
30
52
|
requirements:
|
31
|
-
- -
|
53
|
+
- - ">="
|
32
54
|
- !ruby/object:Gem::Version
|
33
55
|
version: '0'
|
34
56
|
type: :development
|
35
57
|
prerelease: false
|
36
58
|
version_requirements: !ruby/object:Gem::Requirement
|
37
59
|
requirements:
|
38
|
-
- -
|
60
|
+
- - ">="
|
39
61
|
- !ruby/object:Gem::Version
|
40
62
|
version: '0'
|
41
63
|
- !ruby/object:Gem::Dependency
|
42
64
|
name: test-unit
|
43
65
|
requirement: !ruby/object:Gem::Requirement
|
44
66
|
requirements:
|
45
|
-
- -
|
67
|
+
- - ">="
|
46
68
|
- !ruby/object:Gem::Version
|
47
69
|
version: '0'
|
48
70
|
type: :development
|
49
71
|
prerelease: false
|
50
72
|
version_requirements: !ruby/object:Gem::Requirement
|
51
73
|
requirements:
|
52
|
-
- -
|
74
|
+
- - ">="
|
53
75
|
- !ruby/object:Gem::Version
|
54
76
|
version: '0'
|
55
77
|
description: |2
|
@@ -65,12 +87,19 @@ extra_rdoc_files:
|
|
65
87
|
- CHANGES
|
66
88
|
- MANIFEST
|
67
89
|
files:
|
90
|
+
- certs
|
91
|
+
- certs/djberg96_pub.pem
|
68
92
|
- CHANGES
|
93
|
+
- examples
|
69
94
|
- examples/example_semaphore.rb
|
95
|
+
- lib
|
96
|
+
- lib/win32
|
70
97
|
- lib/win32/semaphore.rb
|
98
|
+
- lib/win32-semaphore.rb
|
71
99
|
- MANIFEST
|
72
100
|
- Rakefile
|
73
101
|
- README
|
102
|
+
- test
|
74
103
|
- test/test_win32_semaphore.rb
|
75
104
|
- win32-semaphore.gemspec
|
76
105
|
homepage: http://www.github.com/djberg96/win32-semaphore
|
@@ -83,17 +112,17 @@ require_paths:
|
|
83
112
|
- lib
|
84
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
114
|
requirements:
|
86
|
-
- -
|
115
|
+
- - ">"
|
87
116
|
- !ruby/object:Gem::Version
|
88
117
|
version: 1.9.0
|
89
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
119
|
requirements:
|
91
|
-
- -
|
120
|
+
- - ">="
|
92
121
|
- !ruby/object:Gem::Version
|
93
122
|
version: '0'
|
94
123
|
requirements: []
|
95
|
-
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.4.8
|
97
126
|
signing_key:
|
98
127
|
specification_version: 4
|
99
128
|
summary: Interface to MS Windows Semaphore objects.
|
metadata.gz.sig
ADDED
Binary file
|