Module: Synctest::Patches::MonitorPatch
- Defined in:
- lib/synctest/patches.rb
Instance Method Summary collapse
- #enter ⇒ Object
- #exit ⇒ Object
- #initialize ⇒ Object
- #mon_enter ⇒ Object
- #mon_exit ⇒ Object
- #mon_owned? ⇒ Boolean
- #mon_synchronize(&block) ⇒ Object
- #mon_try_enter ⇒ Object
- #synchronize ⇒ Object
- #try_enter ⇒ Object
- #try_mon_enter ⇒ Object
- #wait_for_cond(condition, timeout) ⇒ Object
Instance Method Details
#enter ⇒ Object
304 305 306 307 308 309 310 |
# File 'lib/synctest/patches.rb', line 304 def enter bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_enter(self) nil end |
#exit ⇒ Object
341 342 343 344 345 346 347 |
# File 'lib/synctest/patches.rb', line 341 def exit bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_exit(self) nil end |
#initialize ⇒ Object
299 300 301 302 |
# File 'lib/synctest/patches.rb', line 299 def initialize(...) super Synctest.associate(self) end |
#mon_enter ⇒ Object
312 313 314 315 316 317 318 |
# File 'lib/synctest/patches.rb', line 312 def mon_enter bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_enter(self) nil end |
#mon_exit ⇒ Object
349 350 351 352 353 354 355 |
# File 'lib/synctest/patches.rb', line 349 def mon_exit bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_exit(self) nil end |
#mon_owned? ⇒ Boolean
357 358 359 360 361 362 |
# File 'lib/synctest/patches.rb', line 357 def mon_owned? bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_owned?(self) end |
#mon_synchronize(&block) ⇒ Object
378 379 380 381 382 383 |
# File 'lib/synctest/patches.rb', line 378 def mon_synchronize(&block) bubble = Synctest.bubble_for_operation(self) return super unless bubble synchronize(&block) end |
#mon_try_enter ⇒ Object
327 328 329 330 331 332 |
# File 'lib/synctest/patches.rb', line 327 def mon_try_enter bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_try_enter(self) end |
#synchronize ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/synctest/patches.rb', line 364 def synchronize bubble = Synctest.bubble_for_operation(self) return super unless bubble entered = false begin bubble.monitor_enter(self) entered = true yield ensure bubble.monitor_exit(self) if entered end end |
#try_enter ⇒ Object
320 321 322 323 324 325 |
# File 'lib/synctest/patches.rb', line 320 def try_enter bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_try_enter(self) end |
#try_mon_enter ⇒ Object
334 335 336 337 338 339 |
# File 'lib/synctest/patches.rb', line 334 def try_mon_enter bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_try_enter(self) end |
#wait_for_cond(condition, timeout) ⇒ Object
385 386 387 388 389 390 |
# File 'lib/synctest/patches.rb', line 385 def wait_for_cond(condition, timeout) bubble = Synctest.bubble_for_operation(self) return super unless bubble bubble.monitor_wait(self, condition, timeout) end |