[REBOL] Re: search-for [ semaphores threads ]
From: dockimbel:free at: 18-Mar-2002 12:49
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...
--- 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
wait server ; wait until other process finished his job
result: copy server
print ["Calculation finished, result =" result]
--- file: calc-server.r ---
Comment: "Process doing calculation (acting as server)"
simulate-calc: func [duration /local t][
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