Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between Kernel#sleep and Thread.stop

Are:

  • Kernel#sleep used without an argument, and
  • Thread.stop

equivalent? If not, what differences are there?

like image 225
sawa Avatar asked Mar 01 '26 18:03

sawa


1 Answers

i think that you are asking if calling sleep or stop within a running thread are equivalent. i would say that, yes, it's semantically the same, but they call different lowlevel functions:

stop -> rb_thread_sleep_deadly();
sleep -> rb_thread_sleep_forever();
like image 183
phoet Avatar answered Mar 04 '26 09:03

phoet