sync/{sem_mutex_symmetric/sem_mutex_symmetric.alg.c → multiplex/multiplex.alg.c} RENAMED
@@ -1,12 +1,12 @@
1
  shared count := 0
2
- shared mutex := semaphore(1)
3
 
4
  main:
5
  thread_count := read_integer()
 
 
6
  create_thread(secondary, thread_count)
7
 
8
  secondary:
9
- wait(mutex)
10
- // Critical section
11
  count := count + 1
12
- signal(mutex)
1
  shared count := 0
 
2
 
3
  main:
4
  thread_count := read_integer()
5
+ upper_limit := read_integer();
6
+ shared multiplex := semaphore(upper_limit)
7
  create_thread(secondary, thread_count)
8
 
9
  secondary:
10
+ wait(multiplex)
 
11
  count := count + 1
12
+ signal(multiplex)