[Python] Why we say dequeue in python is threadsafe when GIL already restricts running one...

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    From what I have been reading Python has GIL that ensures only one thread can run the python code. So I am slightly confused when we say collections.dequeue is thread-safe. If only one thread is run at a time wouldn't objects be in a consistent state already?

    It would be great if someone can give an example of how a list in python is not thread safe and using a dequeue possible counters that?

    Continue reading...

Compartilhe esta Página