auto commit
This commit is contained in:
parent
a74e6762e2
commit
b64ecc6dbe
|
@ -269,11 +269,7 @@ down 和 up 操作需要被设计成原语,不可分割,通常的做法是
|
|||
如果信号量的取值只能为 0 或者 1,那么就成为了**互斥量(Mutex)**,0 表示临界区已经加锁,1 表示临界区解锁。
|
||||
|
||||
```c
|
||||
<<<<<<< HEAD
|
||||
typedef int semaphore ;
|
||||
=======
|
||||
typedef int semaphore;
|
||||
>>>>>>> bedf25d3f0312d8e38953d742d42dbf87585980e
|
||||
semaphore mutex = 1;
|
||||
void P1() {
|
||||
down(mutex);
|
||||
|
@ -296,11 +292,7 @@ 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