libuv 2.0.6 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libuv.rb +18 -17
- data/lib/libuv/loop.rb +9 -3
- data/lib/libuv/version.rb +1 -1
- data/spec/zen_spec.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ddc84e1a810a7612a8110fff4ca3198e64491c
|
4
|
+
data.tar.gz: b2fabb89a9157bb01ea0a7d9d46546460c1bccd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a11115fd3ee36971ad3a79bd6c7b2e413d2f37738e2e64d2eab37fd3e218f6b3e385d07b8dccbebe4ac1119ea3d6c437262215e414d10eb5cebb4e9768fb1f1
|
7
|
+
data.tar.gz: 86343c92ae7edfa6606bff919242127083620db9c2d254074b533c19d9db98dca9588c741765ae344d11ae1280b9344501ff3443a78431564a403f3321d72a74
|
data/lib/libuv.rb
CHANGED
@@ -6,35 +6,36 @@ module Libuv
|
|
6
6
|
require 'libuv/error' # List of errors (matching those in uv.h)
|
7
7
|
require 'libuv/q' # The promise library
|
8
8
|
|
9
|
+
# -- The classes required for a loop instance --
|
9
10
|
require 'libuv/mixins/assertions' # Common code to check arguments
|
10
|
-
require 'libuv/mixins/fs_checks' # Common code to check file system results
|
11
11
|
require 'libuv/mixins/resource' # Common code to check for errors
|
12
12
|
require 'libuv/mixins/listener' # Common callback code
|
13
|
-
require 'libuv/mixins/stream' # For all libuv streams (tcp, pipes, tty)
|
14
|
-
require 'libuv/mixins/net' # Common functions for tcp and udp
|
15
13
|
|
16
|
-
# -- The classes required for a loop instance --
|
17
14
|
require 'libuv/handle' # Base class for most libuv functionality
|
15
|
+
require 'libuv/prepare' # Called at the end of a loop cycle
|
18
16
|
require 'libuv/async' # Provide a threadsafe way to signal the event loop
|
19
17
|
require 'libuv/timer' # High resolution timer
|
20
18
|
require 'libuv/loop' # The libuv reactor or event loop
|
21
19
|
# --
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
autoload :FsChecks, 'libuv/mixins/fs_checks' # Common code to check file system results
|
22
|
+
autoload :Stream, 'libuv/mixins/stream' # For all libuv streams (tcp, pipes, tty)
|
23
|
+
autoload :Net, 'libuv/mixins/net' # Common functions for tcp and udp
|
24
|
+
|
25
|
+
autoload :Filesystem, 'libuv/filesystem' # Async directory manipulation
|
26
|
+
autoload :FSEvent, 'libuv/fs_event' # Notifies of changes to files and folders as they occur
|
27
|
+
autoload :Signal, 'libuv/signal' # Used to handle OS signals
|
28
|
+
autoload :Check, 'libuv/check' # Called before processing events on the loop
|
29
|
+
autoload :File, 'libuv/file' # Async file reading and writing
|
30
|
+
autoload :Idle, 'libuv/idle' # Called when there are no events to process
|
31
|
+
autoload :Work, 'libuv/work' # Provide work to be completed on another thread (thread pool)
|
32
|
+
autoload :UDP, 'libuv/udp' # Communicate over UDP
|
33
|
+
autoload :Dns, 'libuv/dns' # Async DNS lookup
|
33
34
|
|
34
35
|
# Streams
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
autoload :Pipe, 'libuv/pipe' # Communicate over Pipes
|
37
|
+
autoload :TCP, 'libuv/tcp' # Communicate over TCP
|
38
|
+
autoload :TTY, 'libuv/tty' # Terminal output
|
38
39
|
|
39
40
|
|
40
41
|
# Returns the number of CPU cores on the host platform
|
data/lib/libuv/loop.rb
CHANGED
@@ -62,12 +62,20 @@ module Libuv
|
|
62
62
|
# Create an async call for ending the loop
|
63
63
|
@stop_loop = @loop.async method(:stop_cb)
|
64
64
|
@stop_loop.unref
|
65
|
+
|
66
|
+
# Libuv can prevent the application shutting down once the main thread has ended
|
67
|
+
# The addition of a prepare function prevents this from happening.
|
68
|
+
@loop_prep = Libuv::Prepare.new(@loop, method(:noop))
|
69
|
+
@loop_prep.unref
|
70
|
+
@loop_prep.start
|
65
71
|
end
|
66
72
|
|
67
73
|
|
68
74
|
protected
|
69
75
|
|
70
76
|
|
77
|
+
def noop; end
|
78
|
+
|
71
79
|
def stop_cb
|
72
80
|
LOOPS.delete(@reactor_thread)
|
73
81
|
@reactor_thread = nil
|
@@ -426,9 +434,7 @@ module Libuv
|
|
426
434
|
# Exposed to allow joining on the thread, when run in a multithreaded environment. Performing other actions on the thread has undefined semantics (read: a dangerous endevor).
|
427
435
|
#
|
428
436
|
# @return [Thread]
|
429
|
-
|
430
|
-
@reactor_thread
|
431
|
-
end
|
437
|
+
attr_reader :reactor_thread
|
432
438
|
|
433
439
|
# Tells you whether the Libuv reactor loop is currently running.
|
434
440
|
#
|
data/lib/libuv/version.rb
CHANGED
data/spec/zen_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Libuv::Listener do
|
|
9
9
|
|
10
10
|
# These are created by loop objects and are never cleaned up
|
11
11
|
# This is OK as the loops are expected to execute for the life of the application
|
12
|
-
except = [::Libuv::Async, ::Libuv::Timer]
|
12
|
+
except = [::Libuv::Async, ::Libuv::Timer, ::Libuv::Prepare]
|
13
13
|
|
14
14
|
ObjectSpace.each_object(Class) do |cls|
|
15
15
|
next unless cls.ancestors.include? ::Libuv::Handle
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libuv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bulat Shakirzyanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -335,6 +335,7 @@ files:
|
|
335
335
|
- ext/libuv/test/test-default-loop-close.c
|
336
336
|
- ext/libuv/test/test-delayed-accept.c
|
337
337
|
- ext/libuv/test/test-dlerror.c
|
338
|
+
- ext/libuv/test/test-eintr-handling.c
|
338
339
|
- ext/libuv/test/test-embed.c
|
339
340
|
- ext/libuv/test/test-emfile.c
|
340
341
|
- ext/libuv/test/test-error.c
|
@@ -345,6 +346,7 @@ files:
|
|
345
346
|
- ext/libuv/test/test-get-currentexe.c
|
346
347
|
- ext/libuv/test/test-get-loadavg.c
|
347
348
|
- ext/libuv/test/test-get-memory.c
|
349
|
+
- ext/libuv/test/test-get-passwd.c
|
348
350
|
- ext/libuv/test/test-getaddrinfo.c
|
349
351
|
- ext/libuv/test/test-getnameinfo.c
|
350
352
|
- ext/libuv/test/test-getsockname.c
|
@@ -384,6 +386,7 @@ files:
|
|
384
386
|
- ext/libuv/test/test-poll-closesocket.c
|
385
387
|
- ext/libuv/test/test-poll.c
|
386
388
|
- ext/libuv/test/test-process-title.c
|
389
|
+
- ext/libuv/test/test-queue-foreach-delete.c
|
387
390
|
- ext/libuv/test/test-ref.c
|
388
391
|
- ext/libuv/test/test-run-nowait.c
|
389
392
|
- ext/libuv/test/test-run-once.c
|
@@ -425,6 +428,7 @@ files:
|
|
425
428
|
- ext/libuv/test/test-timer-again.c
|
426
429
|
- ext/libuv/test/test-timer-from-check.c
|
427
430
|
- ext/libuv/test/test-timer.c
|
431
|
+
- ext/libuv/test/test-tmpdir.c
|
428
432
|
- ext/libuv/test/test-tty.c
|
429
433
|
- ext/libuv/test/test-udp-bind.c
|
430
434
|
- ext/libuv/test/test-udp-create-socket-early.c
|