diff --git a/core/mutex.rbs b/core/mutex.rbs new file mode 100644 index 0000000..4040225 --- /dev/null +++ b/core/mutex.rbs @@ -0,0 +1,13 @@ +class Mutex + def initialize: () -> void + + def lock: () -> self + + def unlock: () -> self + + def try_lock: () -> bool + + def locked?: () -> bool + + def owned?: () -> bool +end diff --git a/test/mutex.rb b/test/mutex.rb new file mode 100644 index 0000000..9ca5d54 --- /dev/null +++ b/test/mutex.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +mutex = Mutex.new + +mutex.lock + +mutex.unlock + +mutex.try_lock + +mutex.locked? + +mutex.owned?