win32 - threads?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?

win32 - threads?

Postby pber » Wed Feb 25, 2015 3:32 am

Hi all,
fork and spawn (if I'm not wrong) do not work on windows.
Does exist another way to multiprocessing in newLisp

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

Re: win32 - threads?

Postby Lutz » Wed Feb 25, 2015 2:33 pm

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: win32 - threads?

Postby pber » Wed Feb 25, 2015 7:21 pm

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
pber
 
Posts: 2
Joined: Thu Apr 10, 2014 8:58 pm

Re: win32 - threads?

Postby Lutz » Wed Feb 25, 2015 9:38 pm

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP and the O.S.

Who is online

Users browsing this forum: No registered users and 1 guest

cron