search-for [ semaphores threads ]
[1/7] from: robolinth:nodep:dds:nl at: 17-Mar-2002 21:14
Hello All,
Running into a issue where I would like to
have 1 rebol script wait for the other rebol script.
Or: script 1 calculates, script 2 needs to pick it up.
There are some ways to do this, probably the architecture
of the rebol/core does not allow this until now?
if anyone has a good alternative I would be happy to know.
I cant find any "wait-for" or threading inside rebol so that
leaves me with alternatives working on a unix machine.
There is only one problem! the scripts cannot/may not write to disk!
So that leaves me with:
* Using tcp/udp for threading
* Using IPC.
(dont know how to create those filesockets in rebol though :(
(Which brings me to an issue, Im not sure if the RT is working on it
but it would be so nice to create files and do a chmod on them...)
* Using a pipe.
( well did not see an example how this could work in rebol until now.)
* Last but now least, using a file as semaphore buffer.
(unfortunenaty this cannot be used!)
Any other suggestions are welcome!
(R)egards,
Norman
[2/7] from: joel:neely:fedex at: 17-Mar-2002 21:12
Hi, Norman,
[Robolinth--nodep--dds--nl] wrote:
> Running into a issue where I would like to
> have 1 rebol script wait for the other rebol script.
<<quoted lines omitted: 4>>
> * Using IPC.
> * Using a pipe.
Is it necessary to use two separate scripts? Would you be
able to combine them using something like the last example
in
http://www.rebolforces.com/articles/ria2.html
for example? Do the two scripts/processes need to interact
via a strict producer/consumer pattern?
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]
[3/7] from: greggirwin:mindspring at: 17-Mar-2002 21:30
Hi Norman,
<< I cant find any "wait-for" or threading inside rebol...>>
I haven't used ports for this, but you might be able to. REBOL doesn't have
any native multithreading support but you could probably build a little FSM
based solution without too much difficulty.
--Gregg
[4/7] from: gchiu:compkarori at: 18-Mar-2002 15:39
> Running into a issue where I would like to
> have 1 rebol script wait for the other rebol script.
> Or: script 1 calculates, script 2 needs to pick it up.
Sounds like a job for super rugby!
--
Graham Chiu
[5/7] from: koopmans:itr:ing:nl at: 18-Mar-2002 12:39
www.rebolforces.com/~erebol
for Rugby, the re bol broker + simple threading.
--Maarten
On Sunday 17 March 2002 21:14, you wrote:
[6/7] 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:
[7/7] from: chalz:earthlink at: 18-Mar-2002 23:00
I love hearing that. "Execute this code, and watch what happens." <insert
evil laughter here> "What? blowyourassup.exe? Oh, no, it's just a random
name I chose..." Heh.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted