home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / EFFO / pd6.lzh / TST / rendezvous.tst < prev    next >
Text File  |  1989-12-23  |  1KB  |  69 lines

  1. .( Loading Rendezvous test...) cr
  2.  
  3. #include multi_tasking.f83
  4.  
  5. multi-tasking 
  6.  
  7.  
  8. .( 1: A simple server task that performs the service one-plus) cr
  9.  
  10. RENDEZVOUS service ( n -- m)
  11.  
  12. 100 100 task.type SERVER
  13. task.body
  14.   begin
  15.     accept service ( arg -- res)
  16.       1+
  17.     accept.end
  18.   again
  19. task.end
  20.  
  21. SERVER aServer
  22.  
  23.  
  24. .( 2: A multiple read buffer with services put and get) cr
  25.  
  26. RENDEZVOUS put ( n -- nil)
  27. RENDEZVOUS get ( nil -- n)
  28.  
  29. 100 100 task.type BUFFER
  30.   long item
  31. task.body
  32.   accept put ( item -- nil)
  33.     item ! nil
  34.   accept.end
  35.   begin
  36.     ?awaiting put if
  37.       accept put ( item -- nil)
  38.        item ! nil
  39.       accept.end
  40.     then
  41.     ?awaiting get if
  42.       accept get ( nil -- item)
  43.        drop item @
  44.       accept.end
  45.     then
  46.     detach
  47.   again
  48. task.end
  49.  
  50. BUFFER aBuffer
  51.  
  52.  
  53. .( 3: A demon task which feed the two other tasks with calls) cr
  54.  
  55. 100 100 task.type DEMON
  56. task.body
  57.   begin
  58.     nil get service put drop
  59.   again
  60. task.end
  61.  
  62. DEMON aDevil
  63.  
  64. .( 4: Initiate the buffer and run the scenario) cr
  65.  
  66. 0 put drop 1000 delay 0 get . cr
  67.  
  68. forth only
  69.