
; Mutex for N procs with lock cmpxchg (safe version)
	
begin shared_data
    Lock    dd  0
end shared_data

begin thread_code
entr: mov ecx, 1
req:  mov eax, 0
      lock cmpxchg dword [Lock], ecx
      jne req
cs:   ; critical section
exit: mov dword [Lock], 0
      jmp entr
end thread_code

begin init_code
    start_threads
end init_code

begin unsafe_prop
  eip[$t1] = cs && eip[$t2] = cs
end unsafe_prop
