Form 80, 50 Module CheckIt { Thread.Plan Concurrent Class mutex { mylock as boolean=True Function Lock { if not .mylock then exit .mylock<=False =True } Module Unlock { .mylock<=True } } Group PhoneBooth { NowUser$ module UseIt (a$, x){ .NowUser$<=a$ Print a$+" phone home ",Int(x*100);"%" } module leave { .NowUser$<="" } } m=mutex() Flush Data "Bob", "John","Tom" For i=1 to 3 { Thread { \\ we use N$, C and Max as stack variables for each thread \\ all other variables are shared for module If C=0 Then if not m.lock() then Print N$+" waiting...................................":Refresh 20: Continue C++ if c=1 then thread this interval 20 PhoneBooth.UseIt N$,C/Max iF C"" Then { Print "Phone:";PhoneBooth.NowUser$: Refresh } Else.if Service then Print "Service Time": Refresh } } CheckIt