xthreads 0.1.5 → 0.1.6

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: 2a6f41e03b20fbf799b6c71b541afb1830f37541
4
- data.tar.gz: c031e94976c8aca16947fc93f01e9542f6571bf9
3
+ metadata.gz: e2fd1d7150404eb82c1404d28bea6a962f3957cd
4
+ data.tar.gz: b0373bcdfd3ca3b334d46eff929b61faaa10c539
5
5
  SHA512:
6
- metadata.gz: eecb725f88e9794a33852d03c9cc53328628589cb65ae053eabea5e2f76b89e5728be9646e1784ebbec1ba4737c40b75e9f7e4f46872cd0333b6da662179ab66
7
- data.tar.gz: b80306c3997abc8bb7975f63ff549e3027780aba2141483e4390a7b8851e8d45ec496b14ab79d3a0fd74ae0cdd734f1412897d08867d56d386f47a5d5def186f
6
+ metadata.gz: 3ad823121794ea0899129963550c0a3d67a556f7cf092fbcce9aea7c550752d9b377c74bd883498254d7623589abf642ecebb008000b1d35c06cf930748b64a4
7
+ data.tar.gz: a72b66dcd110c33c7c8f4cd968cfbbea145ea86ce52e85b3a8226a320092ade15fb8ba20b57b55c4b92bcd0872586ded816214212a9284b560be9b98772700db
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/xthreads.rb CHANGED
@@ -13,12 +13,15 @@ class XThreads < Hash
13
13
  attr_reader :state, :result
14
14
 
15
15
  def initialize(name, args, options={}, &blk)
16
+
16
17
  opts = {interval: 4, loop: true}.merge(options)
18
+ @loop = opts[:loop]
19
+
17
20
  @name = name
18
21
  @initialized = true
19
22
  @state = :stop
20
23
 
21
- @thread = Thread.new(*args)do
24
+ @thread = Thread.new(*args) {
22
25
  puts "#{name} created\n"
23
26
  Thread.current['name'] = name
24
27
  loop = true
@@ -41,14 +44,16 @@ class XThreads < Hash
41
44
 
42
45
  sleep opts[:interval]
43
46
  end
44
- end
47
+ }
48
+
45
49
 
46
50
  end
47
51
 
48
52
  def start
53
+
49
54
  puts "#{@name} starting ..."
50
55
  @state = :start
51
- @thread.run
56
+ @thread.send @loop == true ? :join : :run
52
57
  end
53
58
 
54
59
  def stop
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xthreads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file