celluloid 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,27 +59,27 @@ module Celluloid
59
59
  module Linking
60
60
  # Link this actor to another, allowing it to crash or react to errors
61
61
  def link(actor)
62
- actor.notify_link(@proxy)
62
+ actor.notify_link(@_proxy)
63
63
  self.notify_link(actor)
64
64
  end
65
65
 
66
66
  # Remove links to another actor
67
67
  def unlink(actor)
68
- actor.notify_unlink(@proxy)
68
+ actor.notify_unlink(@_proxy)
69
69
  self.notify_unlink(actor)
70
70
  end
71
71
 
72
72
  def notify_link(actor)
73
- @links << actor
73
+ @_links << actor
74
74
  end
75
75
 
76
76
  def notify_unlink(actor)
77
- @links.delete actor
77
+ @_links.delete actor
78
78
  end
79
79
 
80
80
  # Is this actor linked to another?
81
81
  def linked_to?(actor)
82
- @links.include? actor
82
+ @_links.include? actor
83
83
  end
84
84
  end
85
85
  end
@@ -1,5 +1,5 @@
1
1
  !RBIX
2
- 3578385345186687227
2
+ 3246536075095810518
3
3
  18
4
4
  M
5
5
  1
@@ -1483,8 +1483,8 @@ n
1483
1483
  p
1484
1484
  2
1485
1485
  x
1486
- 6
1487
- @proxy
1486
+ 7
1487
+ @_proxy
1488
1488
  x
1489
1489
  11
1490
1490
  notify_link
@@ -1559,8 +1559,8 @@ n
1559
1559
  p
1560
1560
  2
1561
1561
  x
1562
- 6
1563
- @proxy
1562
+ 7
1563
+ @_proxy
1564
1564
  x
1565
1565
  13
1566
1566
  notify_unlink
@@ -1622,8 +1622,8 @@ n
1622
1622
  p
1623
1623
  2
1624
1624
  x
1625
- 6
1626
- @links
1625
+ 7
1626
+ @_links
1627
1627
  x
1628
1628
  2
1629
1629
  <<
@@ -1681,8 +1681,8 @@ n
1681
1681
  p
1682
1682
  2
1683
1683
  x
1684
- 6
1685
- @links
1684
+ 7
1685
+ @_links
1686
1686
  x
1687
1687
  6
1688
1688
  delete
@@ -1740,8 +1740,8 @@ n
1740
1740
  p
1741
1741
  2
1742
1742
  x
1743
- 6
1744
- @links
1743
+ 7
1744
+ @_links
1745
1745
  x
1746
1746
  8
1747
1747
  include?
@@ -1,5 +1,5 @@
1
1
  !RBIX
2
- 3578385345186687227
2
+ 3246536075095810518
3
3
  18
4
4
  M
5
5
  1
@@ -1,5 +1,5 @@
1
1
  !RBIX
2
- 3578385345186687227
2
+ 3246536075095810518
3
3
  18
4
4
  M
5
5
  1
@@ -1,5 +1,5 @@
1
1
  !RBIX
2
- 3578385345186687227
2
+ 3246536075095810518
3
3
  18
4
4
  M
5
5
  1
@@ -0,0 +1,25 @@
1
+ module Celluloid
2
+ # Event signaling between methods of the same object
3
+ class Signals
4
+ def initialize
5
+ @waiting = {}
6
+ end
7
+
8
+ # Wait for the given signal name and return the associated value
9
+ def wait(name)
10
+ fibers = @waiting[name] ||= []
11
+ fibers << Fiber.current
12
+ Fiber.yield
13
+ end
14
+
15
+ # Send a signal to all method calls waiting for the given name
16
+ # Returns true if any calls were signaled, or false otherwise
17
+ def send(name, value = nil)
18
+ fibers = @waiting.delete name
19
+ return unless fibers
20
+
21
+ fibers.each { |fiber| fiber.resume value }
22
+ true
23
+ end
24
+ end
25
+ end
@@ -1,6 +1,6 @@
1
1
  !RBIX
2
- 10565180300906495541
3
- x
2
+ 3246536075095810518
3
+ 18
4
4
  M
5
5
  1
6
6
  n
@@ -46,6 +46,8 @@ I
46
46
  0
47
47
  I
48
48
  0
49
+ I
50
+ 0
49
51
  n
50
52
  p
51
53
  5
@@ -66,36 +68,34 @@ x
66
68
  9
67
69
  Celluloid
68
70
  i
69
- 31
71
+ 29
70
72
  5
71
73
  66
72
74
  99
73
75
  7
74
76
  0
75
- 45
76
77
  1
77
- 2
78
78
  65
79
79
  49
80
- 3
80
+ 1
81
81
  3
82
82
  13
83
83
  99
84
84
  12
85
85
  7
86
- 4
86
+ 2
87
87
  12
88
88
  7
89
- 5
89
+ 3
90
90
  12
91
91
  65
92
92
  12
93
93
  49
94
- 6
94
+ 4
95
95
  4
96
96
  15
97
97
  49
98
- 4
98
+ 2
99
99
  0
100
100
  11
101
101
  I
@@ -106,16 +106,14 @@ I
106
106
  0
107
107
  I
108
108
  0
109
+ I
110
+ 0
109
111
  n
110
112
  p
111
- 7
112
- x
113
113
  5
114
- Tuple
115
114
  x
116
- 5
117
- Array
118
- n
115
+ 7
116
+ Signals
119
117
  x
120
118
  10
121
119
  open_class
@@ -127,10 +125,10 @@ M
127
125
  n
128
126
  n
129
127
  x
130
- 5
131
- Tuple
128
+ 7
129
+ Signals
132
130
  i
133
- 30
131
+ 44
134
132
  5
135
133
  66
136
134
  99
@@ -160,6 +158,20 @@ i
160
158
  49
161
159
  3
162
160
  4
161
+ 15
162
+ 99
163
+ 7
164
+ 6
165
+ 7
166
+ 7
167
+ 65
168
+ 67
169
+ 49
170
+ 2
171
+ 0
172
+ 49
173
+ 3
174
+ 4
163
175
  11
164
176
  I
165
177
  5
@@ -169,247 +181,382 @@ I
169
181
  0
170
182
  I
171
183
  0
184
+ I
185
+ 0
172
186
  n
173
187
  p
174
- 6
188
+ 8
175
189
  x
176
- 3
177
- ===
190
+ 10
191
+ initialize
178
192
  M
179
193
  1
180
194
  n
181
195
  n
182
196
  x
183
- 3
184
- ===
197
+ 10
198
+ initialize
185
199
  i
186
- 26
187
- 20
188
- 0
189
- 7
200
+ 10
201
+ 44
202
+ 43
190
203
  0
204
+ 78
191
205
  49
192
206
  1
193
207
  1
194
- 9
195
- 12
196
- 1
197
- 8
198
- 14
199
- 3
200
- 11
201
- 15
202
- 5
203
- 48
204
- 2
205
- 56
206
- 3
207
- 50
208
- 4
209
- 0
210
- 15
208
+ 38
211
209
  2
212
210
  11
213
211
  I
214
- 3
212
+ 2
215
213
  I
216
- 1
214
+ 0
217
215
  I
218
- 1
216
+ 0
219
217
  I
220
- 1
218
+ 0
219
+ I
220
+ 0
221
221
  n
222
222
  p
223
+ 3
224
+ x
225
+ 4
226
+ Hash
227
+ x
228
+ 16
229
+ new_from_literal
230
+ x
231
+ 8
232
+ @waiting
233
+ p
234
+ 5
235
+ I
236
+ -1
237
+ I
238
+ 4
239
+ I
240
+ 0
241
+ I
223
242
  5
243
+ I
244
+ a
224
245
  x
225
- 2
226
- []
246
+ 50
247
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
248
+ p
249
+ 0
227
250
  x
228
- 11
229
- respond_to?
251
+ 17
252
+ method_visibility
253
+ x
254
+ 15
255
+ add_defn_method
230
256
  x
231
257
  4
232
- size
258
+ wait
233
259
  M
234
260
  1
235
- p
236
- 2
237
- x
238
- 9
239
- for_block
240
- t
261
+ n
241
262
  n
242
263
  x
243
- 3
244
- ===
264
+ 4
265
+ wait
245
266
  i
246
- 29
247
- 57
248
- 19
267
+ 50
268
+ 39
249
269
  0
250
- 15
251
- 5
252
270
  20
253
271
  0
254
- 47
272
+ 14
273
+ 2
255
274
  49
256
- 0
257
275
  1
258
- 21
259
276
  1
277
+ 13
278
+ 10
279
+ 24
280
+ 15
281
+ 35
260
282
  0
261
- 20
262
- 0
283
+ 13
284
+ 18
285
+ 3
263
286
  49
264
- 0
287
+ 2
288
+ 2
289
+ 15
290
+ 8
291
+ 28
292
+ 18
293
+ 2
294
+ 16
295
+ 2
296
+ 19
265
297
  1
266
- 86
298
+ 15
299
+ 20
267
300
  1
268
- 9
269
- 26
301
+ 45
302
+ 3
303
+ 4
304
+ 49
305
+ 5
306
+ 0
307
+ 49
308
+ 6
270
309
  1
271
- 8
272
- 28
310
+ 15
311
+ 45
273
312
  3
274
- 31
313
+ 7
314
+ 49
315
+ 8
316
+ 0
275
317
  11
276
318
  I
277
- 5
319
+ 6
278
320
  I
279
- 1
321
+ 2
280
322
  I
281
323
  1
282
324
  I
325
+ 0
326
+ I
283
327
  1
284
328
  n
285
329
  p
286
- 2
330
+ 9
331
+ x
332
+ 8
333
+ @waiting
287
334
  x
288
335
  2
289
336
  []
290
337
  x
291
338
  3
292
- ===
293
- p
294
- 3
295
- I
296
- 0
297
- I
298
- 6
299
- I
300
- 1d
339
+ []=
301
340
  x
302
- 48
303
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
304
- p
305
- 1
341
+ 5
342
+ Fiber
343
+ n
306
344
  x
307
- 1
345
+ 7
346
+ current
347
+ x
348
+ 2
349
+ <<
308
350
  n
309
351
  x
310
352
  5
311
- times
353
+ yield
312
354
  p
313
355
  9
314
356
  I
315
357
  -1
316
358
  I
317
- 4
359
+ 9
318
360
  I
319
361
  0
320
362
  I
321
- 5
363
+ a
322
364
  I
323
- f
365
+ 1f
324
366
  I
325
- 6
367
+ b
326
368
  I
327
- 18
369
+ 2b
328
370
  I
329
- 7
371
+ c
330
372
  I
331
- 1a
373
+ 32
332
374
  x
333
- 48
334
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
375
+ 50
376
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
335
377
  p
336
- 1
337
- x
338
- 3
339
- obj
378
+ 2
340
379
  x
341
- 17
342
- method_visibility
380
+ 4
381
+ name
343
382
  x
344
- 15
345
- add_defn_method
383
+ 6
384
+ fibers
346
385
  x
347
- 7
348
- inspect
386
+ 4
387
+ send
349
388
  M
350
389
  1
351
390
  n
352
391
  n
353
392
  x
354
- 7
355
- inspect
393
+ 4
394
+ send
356
395
  i
357
- 16
358
- 5
359
- 49
396
+ 38
397
+ 23
398
+ 1
399
+ 10
400
+ 8
401
+ 1
402
+ 19
403
+ 1
404
+ 15
405
+ 39
360
406
  0
407
+ 20
361
408
  0
362
- 47
363
- 101
409
+ 49
410
+ 1
364
411
  1
365
- 54
366
- 89
412
+ 19
413
+ 2
414
+ 15
415
+ 20
367
416
  2
368
- 47
369
- 101
417
+ 9
418
+ 25
370
419
  1
371
- 63
420
+ 8
421
+ 27
422
+ 1
423
+ 11
424
+ 15
425
+ 20
426
+ 2
427
+ 56
428
+ 2
429
+ 50
430
+ 3
431
+ 0
432
+ 15
372
433
  2
373
434
  11
374
435
  I
375
- 2
436
+ 5
437
+ I
438
+ 3
439
+ I
440
+ 1
376
441
  I
377
442
  0
378
443
  I
444
+ 2
445
+ n
446
+ p
447
+ 4
448
+ x
449
+ 8
450
+ @waiting
451
+ x
452
+ 6
453
+ delete
454
+ M
455
+ 1
456
+ p
457
+ 2
458
+ x
459
+ 9
460
+ for_block
461
+ t
462
+ n
463
+ x
464
+ 4
465
+ send
466
+ i
467
+ 13
468
+ 57
469
+ 19
379
470
  0
471
+ 15
472
+ 20
473
+ 0
474
+ 21
475
+ 1
476
+ 1
477
+ 49
478
+ 0
479
+ 1
480
+ 11
481
+ I
482
+ 4
483
+ I
484
+ 1
485
+ I
486
+ 1
380
487
  I
381
488
  0
489
+ I
490
+ 1
382
491
  n
383
492
  p
493
+ 1
494
+ x
495
+ 6
496
+ resume
497
+ p
384
498
  3
499
+ I
500
+ 0
501
+ I
502
+ 15
503
+ I
504
+ d
505
+ x
506
+ 50
507
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
508
+ p
509
+ 1
385
510
  x
386
511
  5
387
- class
512
+ fiber
388
513
  x
389
514
  4
390
- to_s
391
- x
392
- 7
393
- inspect
515
+ each
394
516
  p
395
- 5
517
+ 13
396
518
  I
397
519
  -1
398
520
  I
399
- a
521
+ 11
522
+ I
523
+ 8
524
+ I
525
+ 12
526
+ I
527
+ 12
528
+ I
529
+ 13
530
+ I
531
+ 1b
400
532
  I
401
533
  0
402
534
  I
403
- b
535
+ 1c
404
536
  I
405
- 10
537
+ 15
538
+ I
539
+ 24
540
+ I
541
+ 16
542
+ I
543
+ 26
406
544
  x
407
- 48
408
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
409
- p
410
- 0
545
+ 50
546
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
411
547
  p
548
+ 3
549
+ x
550
+ 4
551
+ name
552
+ x
412
553
  5
554
+ value
555
+ x
556
+ 6
557
+ fibers
558
+ p
559
+ 7
413
560
  I
414
561
  2
415
562
  I
@@ -417,12 +564,16 @@ I
417
564
  I
418
565
  10
419
566
  I
420
- a
567
+ 9
421
568
  I
422
569
  1e
570
+ I
571
+ 11
572
+ I
573
+ 2c
423
574
  x
424
- 48
425
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
575
+ 50
576
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
426
577
  p
427
578
  0
428
579
  x
@@ -435,10 +586,10 @@ I
435
586
  I
436
587
  3
437
588
  I
438
- 1f
589
+ 1d
439
590
  x
440
- 48
441
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
591
+ 50
592
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
442
593
  p
443
594
  0
444
595
  x
@@ -453,7 +604,7 @@ I
453
604
  I
454
605
  1c
455
606
  x
456
- 48
457
- /Users/tony/src/celluloid/lib/celluloid/tuple.rb
607
+ 50
608
+ /Users/tony/src/celluloid/lib/celluloid/signals.rb
458
609
  p
459
610
  0