-
-
Save davydovanton/0762cf5b3b1b05f854d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Делаем новый тред, который ждет когда выполниться Thread.run | |
# в основном треде. После чего из основного запускаем "заснувший" | |
# тред и получаем дедлок | |
thread = Thread.new { Thread.stop } | |
thread.status # => 'sleep' | |
thread.join # => deadlock! | |
# что бы распутать такую штуку, достаточно просто сделать проверку на статус | |
thread = Thread.new { Thread.stop } | |
thread.run if thread.status == 'sleep' | |
thread.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment