rxio 0.10.4 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33385bc2a14b6cfd16451d8cc6d2e0740a7053c3
4
- data.tar.gz: a56ebeb01f2fa6f607af9201306aded226f6219d
3
+ metadata.gz: 58ba254c8b92e99fce1f72e3e98f490f112ffbba
4
+ data.tar.gz: 64794413e4927e4b7380d5f87d20b7e3dbfe72fa
5
5
  SHA512:
6
- metadata.gz: 8df5df67e6992a945e96406adc403637d766463e743db70e0e732776365b343d17015582c85ebb6172c0bf8bdacc6f54c68157273913f32b0e1b082da86867ca
7
- data.tar.gz: bab36576870263fb7605556db3d0bd77840f0aba826c05f77de78ac6117e0a25ca0c026b9172e8f4123344a63ccd3766474b0c40678cb652e389c1bc03b57242
6
+ metadata.gz: 3539209f39086919b411bf01ef6c5cb5acb8cf07afacdcc4e771509a996bd5421fafaf941ea3a07557f735a32d498132b4f05113d06338304963612ebc4b4703
7
+ data.tar.gz: 5906ac469b314c200ff95810c75073bf74be8c194e9acbd49ebd3270d62283301ddcc4d4ba612191a9c29ea90ab8e16ca749c20478a63779feb82733e1d2d1a4
data/README.md CHANGED
@@ -33,7 +33,7 @@ A _stop_ method is also provided to request the service to terminate.
33
33
 
34
34
  While the _run_ / _stop_ methods offer a simple way to implement a single service within the current thread, some situations may require the wrapping of the service in a separate thread.
35
35
 
36
- A dedicated interface is provided for exactly this: _startup_ / _shutdown_
36
+ Thank to [Runify](https://rubygems.org/gems/runify), a dedicated interface is provided for exactly this: _startup_ / _shutdown_ / _restart_
37
37
 
38
38
  #### *startup*
39
39
 
@@ -41,9 +41,13 @@ Calling this method will spawn a new thread around the _run_ method, effectively
41
41
 
42
42
  #### *shutdown*
43
43
 
44
- Calling _shutdown_ will request the service to terminate (via the _stop_ method) and wait for the thread to complete (join).
44
+ Calling _shutdown_ will request the service to terminate and wait for the thread to complete (join).
45
45
  Once this method returns, the service has completely terminated (thread dead, all clients disconnected).
46
46
 
47
+ #### *restart*
48
+
49
+ This method is a simple shortcut to _shutdown_ immediately followed by _startup_.
50
+
47
51
  ### Handler Interface
48
52
 
49
53
  The following is a list of methods that should be implemented by the handler module in order to provide a valid interface to the RxIO::Service class that will use it.
data/lib/rxio/service.rb CHANGED
@@ -11,6 +11,9 @@ module RxIO
11
11
  # Service Class
12
12
  class Service
13
13
 
14
+ # Runify
15
+ include Runify
16
+
14
17
  # Chunk Size
15
18
  CHUNK_SIZE = 1024
16
19
 
@@ -38,20 +41,6 @@ module RxIO
38
41
  @cmap = {}
39
42
  end
40
43
 
41
- # Start up
42
- # Spawns a new Thread around the _run_ method to execute the service in the background.
43
- def startup
44
- @thread = Thread.new { run }
45
- end
46
-
47
- # Shutdown
48
- # Gracefully terminates the service, waiting for all resources to be released (returns once the service thread has completed).
49
- def shutdown
50
- @stop = true
51
- @thread.join
52
- @thread = nil
53
- end
54
-
55
44
  # Run
56
45
  # Executes the main service loop, taking care of I/O scheduling, client management and message handling.
57
46
  # Note: this method blocks until the service loop terminates.
data/lib/rxio/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  module RxIO
6
6
 
7
7
  # Version
8
- VERSION = '0.10.4'
8
+ VERSION = '0.11.4'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rxio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse