Python Threads - Critical Section

后端 未结 3 727
走了就别回头了
走了就别回头了 2020-12-31 11:11

What is the \"critical section\" of a thread (in Python)?

A thread enters the critical section by calling the acquire() method, which can either b

3条回答
  •  隐瞒了意图╮
    2020-12-31 11:30

    A "critical section" is a chunk of code in which, for correctness, it is necessary to ensure that only one thread of control can be in that section at a time. In general, you need a critical section to contain references that write values into memory that can be shared among more than one concurrent process.

提交回复
热议问题