Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $global_var_altered = false
- $threads{}
- freq = [1,2,3...]
- object = Object.new
- freq.each do |num|
- $threads[num] = Thread.new {object.function_that_changes_global_var}
- end
- $threads.each do |thr|
- thr.join
- $threads.delete(thr[0])
- end
- p $global_var_altered
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement