packet 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hemant Kumar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-20 00:00:00 +05:30
12
+ date: 2008-02-11 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,32 +28,37 @@ files:
28
28
  - README
29
29
  - Rakefile
30
30
  - TODO
31
- - lib/disconnect_error.rb
32
- - lib/nbio.rb
33
- - lib/worker.rb
34
- - lib/meta_pimp.rb
35
- - lib/packet_guid.rb
36
- - lib/double_keyed_hash.rb
37
- - lib/periodic_event.rb
38
- - lib/callback.rb
39
- - lib/connection.rb
40
- - lib/bin_parser.rb
41
- - lib/packet_master.rb
42
- - lib/class_helpers.rb
43
- - lib/pimp.rb
31
+ - spec/test_double_keyed_hash.rb
32
+ - spec/spec_helper.rb
33
+ - spec/test_packet_core.rb
34
+ - lib/packet
35
+ - lib/packet/disconnect_error.rb
36
+ - lib/packet/packet_pimp.rb
37
+ - lib/packet/packet_connection.rb
38
+ - lib/packet/packet_guid.rb
39
+ - lib/packet/double_keyed_hash.rb
40
+ - lib/packet/packet_master.rb
41
+ - lib/packet/packet_parser.rb
42
+ - lib/packet/packet_periodic_event.rb
43
+ - lib/packet/packet_callback.rb
44
+ - lib/packet/packet_worker.rb
45
+ - lib/packet/packet_core.rb
46
+ - lib/packet/packet_meta_pimp.rb
47
+ - lib/packet/packet_mongrel.rb
48
+ - lib/packet/packet_helper.rb
49
+ - lib/packet/timer_store.rb
50
+ - lib/packet/packet_event.rb
51
+ - lib/packet/packet_nbio.rb
44
52
  - lib/packet.rb
45
- - lib/event.rb
46
- - lib/core.rb
47
- - lib/thread_pool.rb
48
53
  - lib/packet_mongrel.rb
49
- - lib/timer_store.rb
50
- - lib/worker_pool.rb
51
54
  - examples/concurrent_thread.c
52
55
  - examples/sample_server.rb
56
+ - examples/write_bulk.rb
53
57
  - examples/asteroid.h
54
58
  - examples/persistent_print.rb
55
59
  - examples/use_stuff.rb
56
60
  - examples/extconf.h
61
+ - examples/netbeans.jpg
57
62
  - examples/asteroid.c
58
63
  - examples/extconf.rb
59
64
  has_rdoc: true
@@ -1,54 +0,0 @@
1
- module Packet
2
- class WorkData
3
- attr_accessor :data,:block
4
- def initialize(args,&block)
5
- @data = args
6
- @block = block
7
- end
8
- end
9
-
10
- class ThreadPool
11
- attr_accessor :size
12
- attr_accessor :threads
13
- attr_accessor :work_queue
14
- def initialize(size)
15
- @size = size
16
- @threads = []
17
- @work_queue = Queue.new
18
- @running_tasks = Queue.new
19
- @size.times { add_thread }
20
- end
21
- def defer(*args,&block)
22
- @work_queue << WorkData.new(args,&block)
23
- end
24
-
25
- def add_thread
26
- @threads << Thread.new do
27
- while true
28
- task = @work_queue.pop
29
- @running_tasks << task
30
- block_arity = task.block.arity
31
- begin
32
- block_arity == 0 ? task.block.call : task.block.call(*(task.data))
33
- rescue
34
- puts $!
35
- puts $!.backtrace
36
- end
37
- @running_tasks.pop
38
- end
39
- end
40
- end
41
-
42
- # method ensures exclusive run of deferred tasks for 0.5 seconds, so as they do get a chance to run.
43
- def exclusive_run
44
- if @running_tasks.empty? && @work_queue.empty?
45
- return
46
- else
47
- sleep(0.005)
48
- return
49
- end
50
- end
51
- end # end of ThreadPool class
52
-
53
- end # end of Packet module
54
-
@@ -1,10 +0,0 @@
1
- # implements worker pools
2
- # Warning: Work in Progress
3
- # FIXME: but often what user needs is ability to have different workers and control their execution seperately.
4
- # Above requirment comes from BackgrounDrb experience, and may not be used otherwise.
5
-
6
- module Packet
7
- class WorkerPool
8
-
9
- end
10
- end