Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: search-for [ semaphores threads ]

From: dockimbel:free at: 18-Mar-2002 12:49

Hi Norman, Here is a example of multiprocessing with custom IPC in REBOL : 1- Save these two following source files in the same directory 2- Open a REBOL console, change-dir to the directory and do %calc-client.r 3- Watch what happens... HTH, -DocKimbel. --- file: calc-client.r --- REBOL [ Name "Client" File: "calc-client.r" Comment: "Process launching a task and waiting for completion (acting as client)" ] launch "calc-server.r" ; Create a new REBOL process server: open tcp://localhost:1234 print "Waiting..." wait server ; wait until other process finished his job result: copy server close server print ["Calculation finished, result =" result] --- --- file: calc-server.r --- REBOL [ Name: "Server" File: "calc-server.r" Comment: "Process doing calculation (acting as server)" ] simulate-calc: func [duration /local t][ print "Calculating..." t: now/time until [duration < (now/time - t)] 987 ; return some integer fake result ] serve: open tcp://:1234 client: first serve ; wait for other process to connect result: simulate-calc 0:0:10 ; ten second calculation insert client mold result close client close serve quit --- [Robolinth--nodep--dds--nl] wrote: