diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/hooks/multiple.rb | 6 | ||||
-rw-r--r-- | test/ruby/hooks/on_thread_boot.rb | 6 | ||||
-rw-r--r-- | test/ruby/hooks/on_thread_shutdown.rb | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/test/ruby/hooks/multiple.rb b/test/ruby/hooks/multiple.rb index 295b46a9..b1b659a5 100644 --- a/test/ruby/hooks/multiple.rb +++ b/test/ruby/hooks/multiple.rb @@ -1,9 +1,13 @@ require 'securerandom' +@mutex = Mutex.new + on_worker_boot do File.write("./cookie_worker_boot.#{SecureRandom.hex}", "worker booted") end on_thread_boot do - File.write("./cookie_thread_boot.#{SecureRandom.hex}", "thread booted") + @mutex.synchronize do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "thread booted") + end end diff --git a/test/ruby/hooks/on_thread_boot.rb b/test/ruby/hooks/on_thread_boot.rb index 1e05e248..4f88424e 100644 --- a/test/ruby/hooks/on_thread_boot.rb +++ b/test/ruby/hooks/on_thread_boot.rb @@ -1,5 +1,9 @@ require 'securerandom' +@mutex = Mutex.new + on_thread_boot do - File.write("./cookie_thread_boot.#{SecureRandom.hex}", "booted") + @mutex.synchronize do + File.write("./cookie_thread_boot.#{SecureRandom.hex}", "booted") + end end diff --git a/test/ruby/hooks/on_thread_shutdown.rb b/test/ruby/hooks/on_thread_shutdown.rb index e65c1b42..d953b8b7 100644 --- a/test/ruby/hooks/on_thread_shutdown.rb +++ b/test/ruby/hooks/on_thread_shutdown.rb @@ -1,5 +1,9 @@ require 'securerandom' +@mutex = Mutex.new + on_thread_shutdown do - File.write("./cookie_thread_shutdown.#{SecureRandom.hex}", "shutdown") + @mutex.synchronize do + File.write("./cookie_thread_shutdown.#{SecureRandom.hex}", "shutdown") + end end |