auto commit
This commit is contained in:
commit
2900f7a8c8
|
@ -269,7 +269,11 @@ down 和 up 操作需要被设计成原语,不可分割,通常的做法是
|
|||
如果信号量的取值只能为 0 或者 1,那么就成为了**互斥量(Mutex)**,0 表示临界区已经加锁,1 表示临界区解锁。
|
||||
|
||||
```c
|
||||
<<<<<<< HEAD
|
||||
typedef int semaphore ;
|
||||
=======
|
||||
typedef int semaphore;
|
||||
>>>>>>> bedf25d3f0312d8e38953d742d42dbf87585980e
|
||||
semaphore mutex = 1;
|
||||
void P1() {
|
||||
down(mutex);
|
||||
|
@ -292,7 +296,11 @@ void P2() {
|
|||
|
||||
```c
|
||||
#define N 100
|
||||
<<<<<<< HEAD
|
||||
typedef int semaphore ;
|
||||
=======
|
||||
typedef int semaphore;
|
||||
>>>>>>> bedf25d3f0312d8e38953d742d42dbf87585980e
|
||||
semaphore mutex = 1;
|
||||
semaphore empty = N;
|
||||
semaphore full = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user