win32 - threads?

Started by pber, February 24, 2015, 07:32:55 PM

Previous topic - Next topic

pber

Hi all,

fork and spawn (if I'm not wrong) do not work on windows.

Does exist another way to multiprocessing in newLisp



thanks

Lutz

#1
Use process:



http://www.newlisp.org/downloads/newlisp_manual.html#process">http://www.newlisp.org/downloads/newlis ... ml#process">http://www.newlisp.org/downloads/newlisp_manual.html#process



For other related functions (e.g. process communications) see here:



http://www.newlisp.org/downloads/newlisp_manual.html#processes">http://www.newlisp.org/downloads/newlis ... #processes">http://www.newlisp.org/downloads/newlisp_manual.html#processes



newLISP has a very small memory footprint and fast startup time. So don't be afraid to invoke many processes in your application.

pber

#2
Hi,

so you suggest:

run one or more instances of the whole interpreter

and pipe (possibly netsend) them in and out.

...it was simple!



Many thanks Lutz

and congrats for your great work: NewLisp



paolo

Lutz

#3
yes, exactly.



You also could use process to setup net-eval servers on Windows. net-eval encapsulates all net-send, net-receive programming necessary:



newLISP v.10.6.2 32-bit on Win32 IPv4/6 libffi, options: newlisp -h

> (process "newlisp -c -d 5555")
872
> (net-eval "localhost" 5555 '(define (double x) (+ x x)))
(lambda (x) (+ x x))
> (net-eval "localhost" 5555 '(double 1234))
2468
> double
nil
>


the last statement proves that double is defined in the child process, not the current process.



Ps: note, that when doing the same on Unix, you would have to give the full pathname for newlisp, e.g: /usr/bin/newlisp. On Windows it's enough for newlisp.exe to be in the executable path.