win32 - threads?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
pber
Posts: 2
Joined: Thu Apr 10, 2014 8:58 pm

win32 - threads?

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: win32 - threads?

Post 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.

pber
Posts: 2
Joined: Thu Apr 10, 2014 8:58 pm

Re: win32 - threads?

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: win32 - threads?

Post 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.

Locked