File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 5
5
This document provides a high-level view of the changes to the {project-name} by release.
6
6
For a detailed view of what has changed, refer to the {uri-repo} /commits/master[commit history] on GitHub.
7
7
8
+ == Unreleased
9
+
10
+ * fix watchdog race condition leading to `ThreadError(<killed thread>)` on JRuby ({uri-repo}/pull/215[#215])
11
+
8
12
== 2.0.0.rc2 (2021-01-07) - @slonopotamus
9
13
10
14
* Fix release workflow
Original file line number Diff line number Diff line change @@ -227,15 +227,17 @@ def highlight(code, opts = {})
227
227
def with_watchdog ( timeout_time , error_message )
228
228
state_mutex = Mutex . new
229
229
state = :alive
230
+ wd_cleanup = ConditionVariable . new
230
231
231
232
watchdog = timeout_time > 0 ? Thread . new do
232
233
state_mutex . synchronize do
233
- state_mutex . sleep ( timeout_time ) if state != :finished
234
+ wd_cleanup . wait ( state_mutex , timeout_time ) if state != :finished
234
235
if state != :finished
235
236
@log . error error_message
236
237
stop error_message
237
238
state = :timeout
238
239
end
240
+
239
241
end
240
242
end : nil
241
243
begin
@@ -244,7 +246,8 @@ def with_watchdog(timeout_time, error_message)
244
246
if watchdog
245
247
state_mutex . synchronize do
246
248
state = :finished if state == :alive
247
- watchdog . wakeup if watchdog . alive?
249
+ # wake up watchdog thread
250
+ wd_cleanup . signal
248
251
end
249
252
watchdog . join
250
253
end
You can’t perform that action at this time.
0 commit comments