Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions core/thread.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,37 @@ class Thread < Object
#
def self.main: () -> Thread

# <!--
# rdoc-file=thread.c
# - Thread.ignore_deadlock -> true or false
# -->
# Returns the status of the global ``ignore deadlock'' condition. The default is
# `false`, so that deadlock conditions are not ignored.
#
# See also ::ignore_deadlock=.
#
def self.ignore_deadlock: () -> bool

# <!--
# rdoc-file=thread.c
# - Thread.ignore_deadlock = boolean -> true or false
# -->
# Returns the new state. When set to `true`, the VM will not check for deadlock
# conditions. It is only useful to set this if your application can break a
# deadlock condition via some other means, such as a signal.
#
# Thread.ignore_deadlock = true
# queue = Thread::Queue.new
#
# trap(:SIGUSR1){queue.push "Received signal"}
#
# # raises fatal error unless ignoring deadlock
# puts queue.pop
#
# See also ::ignore_deadlock.
#
def self.ignore_deadlock=: (bool) -> bool

# <!--
# rdoc-file=thread.c
# - thr[sym] -> obj or nil
Expand Down
4 changes: 4 additions & 0 deletions test/stdlib/Thread_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class Sub < Thread

testing "singleton(::Thread)"

def test_ignore_deadlock
assert_send_type "() -> bool", Thread, :ignore_deadlock
end

def test_abort_on_exception
assert_send_type "() -> bool", Thread, :abort_on_exception
end
Expand Down
Loading