且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么样的循环是(;;)?

更新时间:2023-10-26 15:29:58

对于本(;;)是一个无限循环的情况类似,而(1)大多数已经提到。你会更经常地看到这一点,在内核互斥codeS,或如互斥等问题哲学家就餐。直到互斥变量被设置为一个特定的值,使得第二工艺获得对资源的访问,所述第二过程不断循环,也称为忙等待。对资源的访问可以是磁盘访问,为此,2过程中使用的竞争互斥体,使得在同一时间只有一个进程中对资源的访问来访问。

The for(;;) is an infinite loop condition, similar to while(1) as most have already mentioned. You would more often see this, in kernel mutex codes, or mutex eg problem such as dining philosophers. Until the mutex variable is set to a particular value, such that a second process gets access to the resource, the second process keeps on looping, also known as busy wait. Access to a resource can be disk access, for which 2 process are competing to gain access using a mutex such that at a time only one process has the access to the resource.