home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECOLIBII / DEMOS / NOVELL / SEMI.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-10  |  1.9 KB  |  73 lines

  1. uses
  2.   eco_novl,
  3.   crt
  4.   
  5.   ;
  6.  
  7.  
  8. var
  9.   x, count,
  10.   station,
  11.   retcode   :  integer;
  12.   handle    :  longint;
  13.   value     : shortint;
  14.  
  15.  
  16. begin
  17.   clrscr;
  18.   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');
  19.   writeln;
  20.   getserverinfo;
  21.   getstation(station,retcode);
  22.   writeln('Use FCONSOLE on server ',serverinfo.name,' to monitor semaphores for station #',station);
  23.   writeln;
  24.   writeln('openning a semaphore');
  25.  
  26.   open_semaphore('JASON was here',1,count,handle,retcode);
  27.  
  28.   writeln('Count=',count);
  29.   writeln('Retcode=',retcode);
  30.   writeln('handle=',handle);
  31.   write('press return to examine semaphore'); readln;
  32.  
  33.   examine_semaphore(handle, value, count, retcode);
  34.  
  35.   writeln('value=',value);
  36.   writeln('count=',count);
  37.   writeln('retcode=',retcode);
  38.   write('press return to signal the semaphore (adds 1 to present value)'); readln;
  39.  
  40.   signal_semaphore(handle,retcode);
  41.  
  42.   write('press return to examine semaphore'); readln;
  43.  
  44.   examine_semaphore(handle, value, count, retcode);
  45.  
  46.   writeln('value=',value);
  47.   writeln('count=',count);
  48.   writeln('retcode=',retcode);
  49.   write('press return to wait_on_semaphore 5 times (subtracts 1 from value each time you wait)'); readln;
  50.  
  51.   wait_on_semaphore(handle, 36, retcode); {36 = wait 2 seconds if negative value}
  52.   wait_on_semaphore(handle, 36, retcode); {USE FCONSOLE to monitor the semaphores from your station}
  53.   wait_on_semaphore(handle, 36, retcode);
  54.   wait_on_semaphore(handle, 36, retcode);
  55.   wait_on_semaphore(handle, 36, retcode);
  56.  
  57.   write('press return to examine semaphore'); readln;
  58.  
  59.   examine_semaphore(handle, value, count, retcode);
  60.  
  61.   writeln('value=',value);
  62.   writeln('count=',count);
  63.   writeln('retcode=',retcode);
  64.  
  65.  
  66.   write('press return to close semaphore'); readln;
  67.  
  68.   close_semaphore(handle,retcode);
  69.  
  70.   writeln('retcode=',retcode);
  71.   write('press return to finish'); readln;
  72. end.
  73.