home *** CD-ROM | disk | FTP | other *** search
- uses
- eco_novl,
- crt
-
- ;
-
-
- var
- x, count,
- station,
- retcode : integer;
- handle : longint;
- value : shortint;
-
-
- begin
- clrscr;
- writeln('T E S T P R O G R A M F O R S E M A P H O R E S');
- writeln;
- getserverinfo;
- getstation(station,retcode);
- writeln('Use FCONSOLE on server ',serverinfo.name,' to monitor semaphores for station #',station);
- writeln;
- writeln('openning a semaphore');
-
- open_semaphore('JASON was here',1,count,handle,retcode);
-
- writeln('Count=',count);
- writeln('Retcode=',retcode);
- writeln('handle=',handle);
- write('press return to examine semaphore'); readln;
-
- examine_semaphore(handle, value, count, retcode);
-
- writeln('value=',value);
- writeln('count=',count);
- writeln('retcode=',retcode);
- write('press return to signal the semaphore (adds 1 to present value)'); readln;
-
- signal_semaphore(handle,retcode);
-
- write('press return to examine semaphore'); readln;
-
- examine_semaphore(handle, value, count, retcode);
-
- writeln('value=',value);
- writeln('count=',count);
- writeln('retcode=',retcode);
- write('press return to wait_on_semaphore 5 times (subtracts 1 from value each time you wait)'); readln;
-
- wait_on_semaphore(handle, 36, retcode); {36 = wait 2 seconds if negative value}
- wait_on_semaphore(handle, 36, retcode); {USE FCONSOLE to monitor the semaphores from your station}
- wait_on_semaphore(handle, 36, retcode);
- wait_on_semaphore(handle, 36, retcode);
- wait_on_semaphore(handle, 36, retcode);
-
- write('press return to examine semaphore'); readln;
-
- examine_semaphore(handle, value, count, retcode);
-
- writeln('value=',value);
- writeln('count=',count);
- writeln('retcode=',retcode);
-
-
- write('press return to close semaphore'); readln;
-
- close_semaphore(handle,retcode);
-
- writeln('retcode=',retcode);
- write('press return to finish'); readln;
- end.
-