Skip to content

Commit 7c7d586

Browse files
committed
Need to initialize @mutex and @proceed before calling start_server() to avoid possible thread-race
1 parent c532e43 commit 7c7d586

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ruby-debug-ide.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ def start_server(host = nil, port = 1234, notify_dispatcher = false)
6666
end
6767

6868
def prepare_debugger(options)
69+
@mutex = Mutex.new
70+
@proceed = ConditionVariable.new
71+
6972
start_server(options.host, options.port, options.notify_dispatcher)
7073

7174
raise "Control thread did not start (#{@control_thread}}" unless @control_thread && @control_thread.alive?
7275

73-
@mutex = Mutex.new
74-
@proceed = ConditionVariable.new
75-
7676
# wait for 'start' command
7777
@mutex.synchronize do
7878
@proceed.wait(@mutex)

0 commit comments

Comments
 (0)