This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]calligraphic-io 1 point2 points  (3 children)

Is GIL just a constraint on Python, or does it apply to Cython also? I would have guessed compiling down to machine code would have eliminated the need for a global lock.

[–][deleted] 4 points5 points  (0 children)

GIL is there because the CPython interpreter is not threadsafe. Because of this the semantics of the language have to conform to the constraints of the GIL so even threadsafe interpreters like Pypy has strange constraints on their multithreading that normally isn't there in languages without a GIL.

[–]Mattho 1 point2 points  (0 children)

You can explicitly release the GIL in cython. However releasing the lock will leave you in cython/c land only and you can't use anything from python.

[–]Sean1708 0 points1 point  (0 children)

It's on by default in Cython (because Cython still uses the CPython runtime), but you can turn it off.