DEV Community

Stanislav Kozlovski
Stanislav Kozlovski

Posted on

11 2

Ruby's GIL in a nutshell

Liquid syntax error: Unknown tag 'endcomment'

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (7)

Collapse
 
ur5us profile image
Juri Hahn

Is it just me or has this post disappeared? Here’s a screenshot:

thepracticaldev.s3.amazonaws.com/i...

Collapse
 
tomlobato profile image
Antonio Alberto Lobato

Here too. Maybe the discussion thread locked the main body thread ;)

Collapse
 
enether profile image
Stanislav Kozlovski

I've no idea where this went. Let me reach out to support

Collapse
 
suryapandian7 profile image
surya

Thank you, really nice article.

Collapse
 
tomlobato profile image
Antonio Alberto Lobato

Great, thanks!
One note: without Thread.new around the first loop this code could not ever run both loops in parallel, even if MRI had no GIL. Maybe a typo.

Collapse
 
naixspirit profile image
Spirit

I think it's not a type, the main thread is also a thread

Collapse
 
tomlobato profile image

Of course, the main thread is a... thread, but how that matters for the issue?
Any line of code that runs synchronously forces the next line to wait. So, we need a Thread.new, just to let the interpreter to reach the next line while the first one is running.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay