Skip to content

Commit

Permalink
dev: add some features to the ThreadSynchronizer helper class
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Apr 26, 2024
1 parent 2690e42 commit 44a7f05
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/test_integration_pending.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def send_to_main state
@thread_to_main.push state
end

def wait_for_thread expected_state
state = @thread_to_main.pop
def wait_for_thread expected_state, non_block = false
state = @thread_to_main.pop(non_block)
raise "Invalid state #{state}. #{expected_state} is expected" if state != expected_state
end

def wait_for_main expected_state
state = @main_to_thread.pop
def wait_for_main expected_state, non_block = false
state = @main_to_thread.pop(non_block)
raise "Invalid state #{state}. #{expected_state} is expected" if state != expected_state
end

Expand All @@ -34,6 +34,11 @@ def close_thread
def close_main
@main_to_thread.close
end

def close
close_thread
close_main
end
end

def setup
Expand Down

0 comments on commit 44a7f05

Please sign in to comment.