empathy 0.0.1.RC0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.rdoc +135 -0
- data/Rakefile +33 -0
- data/TESTING.rdoc +11 -0
- data/empathy.gemspec +23 -0
- data/empathy.mspec +34 -0
- data/lib/empathy.rb +162 -0
- data/lib/empathy/em/condition_variable.rb +57 -0
- data/lib/empathy/em/mutex.rb +70 -0
- data/lib/empathy/em/queue.rb +84 -0
- data/lib/empathy/em/thread.rb +363 -0
- data/lib/empathy/object.rb +19 -0
- data/lib/empathy/thread.rb +8 -0
- data/lib/empathy/version.rb +3 -0
- data/mspec/lib/mspec/empathy.rb +19 -0
- data/mspec/lib/mspec/guards/empathy.rb +10 -0
- data/rubyspec/core/kernel/fixtures/__method__.rb +25 -0
- data/rubyspec/core/kernel/fixtures/autoload_b.rb +5 -0
- data/rubyspec/core/kernel/fixtures/autoload_c.rb +5 -0
- data/rubyspec/core/kernel/fixtures/autoload_d.rb +5 -0
- data/rubyspec/core/kernel/fixtures/caller_fixture1.rb +42 -0
- data/rubyspec/core/kernel/fixtures/caller_fixture2.rb +26 -0
- data/rubyspec/core/kernel/fixtures/chomp.rb +4 -0
- data/rubyspec/core/kernel/fixtures/chomp_f.rb +4 -0
- data/rubyspec/core/kernel/fixtures/chop.rb +4 -0
- data/rubyspec/core/kernel/fixtures/chop_f.rb +4 -0
- data/rubyspec/core/kernel/fixtures/classes.rb +410 -0
- data/rubyspec/core/kernel/fixtures/eval_locals.rb +6 -0
- data/rubyspec/core/kernel/fixtures/eval_return_with_lambda.rb +12 -0
- data/rubyspec/core/kernel/fixtures/eval_return_without_lambda.rb +14 -0
- data/rubyspec/core/kernel/fixtures/test.rb +362 -0
- data/rubyspec/core/kernel/sleep_spec.rb +43 -0
- data/rubyspec/core/mutex/lock_spec.rb +8 -0
- data/rubyspec/core/mutex/locked_spec.rb +8 -0
- data/rubyspec/core/mutex/sleep_spec.rb +56 -0
- data/rubyspec/core/mutex/synchronize_spec.rb +8 -0
- data/rubyspec/core/mutex/try_lock_spec.rb +8 -0
- data/rubyspec/core/mutex/unlock_spec.rb +8 -0
- data/rubyspec/core/thread/abort_on_exception_spec.rb +126 -0
- data/rubyspec/core/thread/add_trace_func_spec.rb +7 -0
- data/rubyspec/core/thread/alive_spec.rb +60 -0
- data/rubyspec/core/thread/allocate_spec.rb +9 -0
- data/rubyspec/core/thread/backtrace_spec.rb +7 -0
- data/rubyspec/core/thread/critical_spec.rb +96 -0
- data/rubyspec/core/thread/current_spec.rb +15 -0
- data/rubyspec/core/thread/element_reference_spec.rb +53 -0
- data/rubyspec/core/thread/element_set_spec.rb +46 -0
- data/rubyspec/core/thread/exclusive_spec.rb +20 -0
- data/rubyspec/core/thread/exit_spec.rb +21 -0
- data/rubyspec/core/thread/fixtures/classes.rb +291 -0
- data/rubyspec/core/thread/fork_spec.rb +9 -0
- data/rubyspec/core/thread/group_spec.rb +5 -0
- data/rubyspec/core/thread/initialize_spec.rb +26 -0
- data/rubyspec/core/thread/inspect_spec.rb +48 -0
- data/rubyspec/core/thread/join_spec.rb +63 -0
- data/rubyspec/core/thread/key_spec.rb +64 -0
- data/rubyspec/core/thread/keys_spec.rb +47 -0
- data/rubyspec/core/thread/kill_spec.rb +21 -0
- data/rubyspec/core/thread/list_spec.rb +38 -0
- data/rubyspec/core/thread/main_spec.rb +10 -0
- data/rubyspec/core/thread/new_spec.rb +56 -0
- data/rubyspec/core/thread/pass_spec.rb +8 -0
- data/rubyspec/core/thread/priority_spec.rb +9 -0
- data/rubyspec/core/thread/raise_spec.rb +225 -0
- data/rubyspec/core/thread/run_spec.rb +9 -0
- data/rubyspec/core/thread/safe_level_spec.rb +6 -0
- data/rubyspec/core/thread/set_trace_func_spec.rb +7 -0
- data/rubyspec/core/thread/shared/exit.rb +173 -0
- data/rubyspec/core/thread/shared/start.rb +51 -0
- data/rubyspec/core/thread/shared/wakeup.rb +59 -0
- data/rubyspec/core/thread/start_spec.rb +9 -0
- data/rubyspec/core/thread/status_spec.rb +48 -0
- data/rubyspec/core/thread/stop_spec.rb +66 -0
- data/rubyspec/core/thread/terminate_spec.rb +11 -0
- data/rubyspec/core/thread/value_spec.rb +36 -0
- data/rubyspec/core/thread/wakeup_spec.rb +7 -0
- data/rubyspec/empathy_spec.rb +26 -0
- data/rubyspec/library/conditionvariable/broadcast_spec.rb +62 -0
- data/rubyspec/library/conditionvariable/signal_spec.rb +64 -0
- data/rubyspec/library/conditionvariable/wait_spec.rb +21 -0
- data/rubyspec/library/mutex/lock_spec.rb +10 -0
- data/rubyspec/library/mutex/locked_spec.rb +10 -0
- data/rubyspec/library/mutex/synchronize_spec.rb +10 -0
- data/rubyspec/library/mutex/try_lock_spec.rb +10 -0
- data/rubyspec/library/mutex/unlock_spec.rb +10 -0
- data/rubyspec/library/queue/append_spec.rb +7 -0
- data/rubyspec/library/queue/clear_spec.rb +15 -0
- data/rubyspec/library/queue/deq_spec.rb +7 -0
- data/rubyspec/library/queue/empty_spec.rb +15 -0
- data/rubyspec/library/queue/enq_spec.rb +7 -0
- data/rubyspec/library/queue/length_spec.rb +7 -0
- data/rubyspec/library/queue/num_waiting_spec.rb +19 -0
- data/rubyspec/library/queue/pop_spec.rb +7 -0
- data/rubyspec/library/queue/push_spec.rb +7 -0
- data/rubyspec/library/queue/shared/deque.rb +37 -0
- data/rubyspec/library/queue/shared/enque.rb +10 -0
- data/rubyspec/library/queue/shared/length.rb +9 -0
- data/rubyspec/library/queue/shift_spec.rb +7 -0
- data/rubyspec/library/queue/size_spec.rb +7 -0
- data/rubyspec/shared/kernel/raise.rb +68 -0
- data/rubyspec/shared/mutex/lock.rb +52 -0
- data/rubyspec/shared/mutex/locked.rb +31 -0
- data/rubyspec/shared/mutex/synchronize.rb +23 -0
- data/rubyspec/shared/mutex/try_lock.rb +30 -0
- data/rubyspec/shared/mutex/unlock.rb +35 -0
- data/rubyspec/spec_helper.rb +48 -0
- data/spec/empathy_spec.rb +129 -0
- data/spec/library_spec.rb +79 -0
- data/spec/spec_helper.rb +6 -0
- metadata +222 -0
@@ -0,0 +1,362 @@
|
|
1
|
+
def foo1
|
2
|
+
end
|
3
|
+
|
4
|
+
def foo2
|
5
|
+
end
|
6
|
+
|
7
|
+
def foo3
|
8
|
+
end
|
9
|
+
|
10
|
+
def foo4
|
11
|
+
end
|
12
|
+
|
13
|
+
def foo5
|
14
|
+
end
|
15
|
+
|
16
|
+
def foo6
|
17
|
+
end
|
18
|
+
|
19
|
+
def foo7
|
20
|
+
end
|
21
|
+
|
22
|
+
def foo8
|
23
|
+
end
|
24
|
+
|
25
|
+
def foo9
|
26
|
+
end
|
27
|
+
|
28
|
+
def foo10
|
29
|
+
end
|
30
|
+
|
31
|
+
def foo11
|
32
|
+
end
|
33
|
+
|
34
|
+
def foo12
|
35
|
+
end
|
36
|
+
|
37
|
+
def foo13
|
38
|
+
end
|
39
|
+
|
40
|
+
def foo14
|
41
|
+
end
|
42
|
+
|
43
|
+
def foo15
|
44
|
+
end
|
45
|
+
|
46
|
+
def foo16
|
47
|
+
end
|
48
|
+
|
49
|
+
def foo17
|
50
|
+
end
|
51
|
+
|
52
|
+
def foo18
|
53
|
+
end
|
54
|
+
|
55
|
+
def foo19
|
56
|
+
end
|
57
|
+
|
58
|
+
def foo20
|
59
|
+
end
|
60
|
+
|
61
|
+
def foo21
|
62
|
+
end
|
63
|
+
|
64
|
+
def foo22
|
65
|
+
end
|
66
|
+
|
67
|
+
def foo23
|
68
|
+
end
|
69
|
+
|
70
|
+
def foo24
|
71
|
+
end
|
72
|
+
|
73
|
+
def foo25
|
74
|
+
end
|
75
|
+
|
76
|
+
def foo26
|
77
|
+
end
|
78
|
+
|
79
|
+
def foo27
|
80
|
+
end
|
81
|
+
|
82
|
+
def foo28
|
83
|
+
end
|
84
|
+
|
85
|
+
def foo29
|
86
|
+
end
|
87
|
+
|
88
|
+
def foo30
|
89
|
+
end
|
90
|
+
|
91
|
+
def foo31
|
92
|
+
end
|
93
|
+
|
94
|
+
def foo32
|
95
|
+
end
|
96
|
+
|
97
|
+
def foo33
|
98
|
+
end
|
99
|
+
|
100
|
+
def foo34
|
101
|
+
end
|
102
|
+
|
103
|
+
def foo35
|
104
|
+
end
|
105
|
+
|
106
|
+
def foo36
|
107
|
+
end
|
108
|
+
|
109
|
+
def foo37
|
110
|
+
end
|
111
|
+
|
112
|
+
def foo38
|
113
|
+
end
|
114
|
+
|
115
|
+
def foo39
|
116
|
+
end
|
117
|
+
|
118
|
+
def foo40
|
119
|
+
end
|
120
|
+
|
121
|
+
def foo41
|
122
|
+
end
|
123
|
+
|
124
|
+
def foo42
|
125
|
+
end
|
126
|
+
|
127
|
+
def foo43
|
128
|
+
end
|
129
|
+
|
130
|
+
def foo44
|
131
|
+
end
|
132
|
+
|
133
|
+
def foo45
|
134
|
+
end
|
135
|
+
|
136
|
+
def foo46
|
137
|
+
end
|
138
|
+
|
139
|
+
def foo47
|
140
|
+
end
|
141
|
+
|
142
|
+
def foo48
|
143
|
+
end
|
144
|
+
|
145
|
+
def foo49
|
146
|
+
end
|
147
|
+
|
148
|
+
def foo50
|
149
|
+
end
|
150
|
+
|
151
|
+
def foo51
|
152
|
+
end
|
153
|
+
|
154
|
+
def foo52
|
155
|
+
end
|
156
|
+
|
157
|
+
def foo53
|
158
|
+
end
|
159
|
+
|
160
|
+
def foo54
|
161
|
+
end
|
162
|
+
|
163
|
+
def foo55
|
164
|
+
end
|
165
|
+
|
166
|
+
def foo56
|
167
|
+
end
|
168
|
+
|
169
|
+
def foo57
|
170
|
+
end
|
171
|
+
|
172
|
+
def foo58
|
173
|
+
end
|
174
|
+
|
175
|
+
def foo59
|
176
|
+
end
|
177
|
+
|
178
|
+
def foo60
|
179
|
+
end
|
180
|
+
|
181
|
+
def foo61
|
182
|
+
end
|
183
|
+
|
184
|
+
def foo62
|
185
|
+
end
|
186
|
+
|
187
|
+
def foo63
|
188
|
+
end
|
189
|
+
|
190
|
+
def foo64
|
191
|
+
end
|
192
|
+
|
193
|
+
def foo65
|
194
|
+
end
|
195
|
+
|
196
|
+
def foo66
|
197
|
+
end
|
198
|
+
|
199
|
+
def foo67
|
200
|
+
end
|
201
|
+
|
202
|
+
def foo68
|
203
|
+
end
|
204
|
+
|
205
|
+
def foo69
|
206
|
+
end
|
207
|
+
|
208
|
+
def foo70
|
209
|
+
end
|
210
|
+
|
211
|
+
def foo71
|
212
|
+
end
|
213
|
+
|
214
|
+
def foo72
|
215
|
+
end
|
216
|
+
|
217
|
+
def foo73
|
218
|
+
end
|
219
|
+
|
220
|
+
def foo74
|
221
|
+
end
|
222
|
+
|
223
|
+
def foo75
|
224
|
+
end
|
225
|
+
|
226
|
+
def foo76
|
227
|
+
end
|
228
|
+
|
229
|
+
def foo77
|
230
|
+
end
|
231
|
+
|
232
|
+
def foo78
|
233
|
+
end
|
234
|
+
|
235
|
+
def foo79
|
236
|
+
end
|
237
|
+
|
238
|
+
def foo80
|
239
|
+
end
|
240
|
+
|
241
|
+
def foo81
|
242
|
+
end
|
243
|
+
|
244
|
+
def foo82
|
245
|
+
end
|
246
|
+
|
247
|
+
def foo83
|
248
|
+
end
|
249
|
+
|
250
|
+
def foo84
|
251
|
+
end
|
252
|
+
|
253
|
+
def foo85
|
254
|
+
end
|
255
|
+
|
256
|
+
def foo86
|
257
|
+
end
|
258
|
+
|
259
|
+
def foo87
|
260
|
+
end
|
261
|
+
|
262
|
+
def foo88
|
263
|
+
end
|
264
|
+
|
265
|
+
def foo89
|
266
|
+
end
|
267
|
+
|
268
|
+
def foo90
|
269
|
+
end
|
270
|
+
|
271
|
+
def foo91
|
272
|
+
end
|
273
|
+
|
274
|
+
def foo92
|
275
|
+
end
|
276
|
+
|
277
|
+
def foo93
|
278
|
+
end
|
279
|
+
|
280
|
+
def foo94
|
281
|
+
end
|
282
|
+
|
283
|
+
def foo95
|
284
|
+
end
|
285
|
+
|
286
|
+
def foo96
|
287
|
+
end
|
288
|
+
|
289
|
+
def foo97
|
290
|
+
end
|
291
|
+
|
292
|
+
def foo98
|
293
|
+
end
|
294
|
+
|
295
|
+
def foo99
|
296
|
+
end
|
297
|
+
|
298
|
+
def foo100
|
299
|
+
end
|
300
|
+
|
301
|
+
def foo101
|
302
|
+
end
|
303
|
+
|
304
|
+
def foo102
|
305
|
+
end
|
306
|
+
|
307
|
+
def foo103
|
308
|
+
end
|
309
|
+
|
310
|
+
def foo104
|
311
|
+
end
|
312
|
+
|
313
|
+
def foo105
|
314
|
+
end
|
315
|
+
|
316
|
+
def foo106
|
317
|
+
end
|
318
|
+
|
319
|
+
def foo107
|
320
|
+
end
|
321
|
+
|
322
|
+
def foo108
|
323
|
+
end
|
324
|
+
|
325
|
+
def foo109
|
326
|
+
end
|
327
|
+
|
328
|
+
def foo110
|
329
|
+
end
|
330
|
+
|
331
|
+
def foo111
|
332
|
+
end
|
333
|
+
|
334
|
+
def foo112
|
335
|
+
end
|
336
|
+
|
337
|
+
def foo113
|
338
|
+
end
|
339
|
+
|
340
|
+
def foo114
|
341
|
+
end
|
342
|
+
|
343
|
+
def foo115
|
344
|
+
end
|
345
|
+
|
346
|
+
def foo116
|
347
|
+
end
|
348
|
+
|
349
|
+
def foo117
|
350
|
+
end
|
351
|
+
|
352
|
+
def foo118
|
353
|
+
end
|
354
|
+
|
355
|
+
def foo119
|
356
|
+
end
|
357
|
+
|
358
|
+
def foo120
|
359
|
+
end
|
360
|
+
|
361
|
+
def foo121
|
362
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
require File.expand_path('../fixtures/classes', __FILE__)
|
3
|
+
|
4
|
+
describe "Kernel#sleep" do
|
5
|
+
it "is a private method" do
|
6
|
+
Kernel.should have_private_instance_method(:sleep)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "pauses execution for approximately the duration requested" do
|
10
|
+
duration = 0.1
|
11
|
+
start = Time.now
|
12
|
+
sleep duration
|
13
|
+
(Time.now - start).should be_close(duration, 0.1)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "returns the rounded number of seconds asleep" do
|
17
|
+
sleep(0.01).should be_kind_of(Integer)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "raises a TypeError when passed a non-numeric duration" do
|
21
|
+
lambda { sleep(nil) }.should raise_error(TypeError)
|
22
|
+
lambda { sleep('now') }.should raise_error(TypeError)
|
23
|
+
lambda { sleep('2') }.should raise_error(TypeError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "pauses execution indefinitely if not given a duration" do
|
27
|
+
lock = Channel.new
|
28
|
+
t = Thread.new do
|
29
|
+
lock << :ready
|
30
|
+
sleep
|
31
|
+
5
|
32
|
+
end
|
33
|
+
lock.receive.should == :ready
|
34
|
+
# wait until the thread has gone to sleep
|
35
|
+
Thread.pass while t.status and t.status != "sleep"
|
36
|
+
t.run
|
37
|
+
t.value.should == 5
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "Kernel.sleep" do
|
42
|
+
it "needs to be reviewed for spec completeness"
|
43
|
+
end
|