Page 1 of 1

win32 - threads?

Posted: Wed Feb 25, 2015 3:32 am
by 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

Re: win32 - threads?

Posted: Wed Feb 25, 2015 2:33 pm
by Lutz
Use process:

http://www.newlisp.org/downloads/newlis ... ml#process

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

http://www.newlisp.org/downloads/newlis ... #processes

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

Re: win32 - threads?

Posted: Wed Feb 25, 2015 7:21 pm
by pber
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

Re: win32 - threads?

Posted: Wed Feb 25, 2015 9:38 pm
by Lutz
yes, exactly.

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

Code: Select all

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.