Call of (process ...) + from CGI problem under Win32

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
gaidam
Posts: 2
Joined: Wed Mar 31, 2010 10:12 am
Location: Russia
Contact:

Call of (process ...) + from CGI problem under Win32

Post by gaidam »

Hello,

I have some problem with concurrent processes under Win32.

For my program, I run newlisp as http-server like this:

Code: Select all

newlisp -c -d 8085 -w
Everything is ok, all cgi's working ideally.

The problem arised when I tried to put more parallelism into my program.
I have one long process and I'd like to start it from cgi-script to run at the same time as the main program.
I've tried to create new process with the code below:

Code: Select all

(process "newlisp.exe my-proc.lsp")
This is really non-blocking call, and (process) returns immediately.
What is worse is I don't get response from cgi script till my-proc.lsp finished.
It is strange, because all of cgi-script's functions are finished working normally, as I checked.

Does anybody know how to solve the problem?
Dmitry

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

Re: Call of (process ...) + from CGI problem under Win32

Post by Lutz »

Nothing we can do. The same happens on Mac OS X or other UNIX and when using the Apache webserver. The process call inside the cgi script returns immediately, but the cgi script doesn't exit until the the child process started has finished. Probably due to the fact that the child process started from the cgi process uses the same std I/O channel as the cgi script.

Off topic: when specifying the -w option must specify a directory path, or just don't use -w, then it defaults to the current directory.

gaidam
Posts: 2
Joined: Wed Mar 31, 2010 10:12 am
Location: Russia
Contact:

Re: Call of (process ...) + from CGI problem under Win32

Post by gaidam »

Thanks a lot! But... Maybe I do something wrong... How can I start another newlisp script in parallel with http-server? Is there the only solution if I have previously started separated "worker process" to wait for my controlling signals from cgi scripts? It's seems a bit tricky for me, because in our server we use feature of "idle processes" widely. Would You recommend something simpler? (I understood about using "-w" flag, thanks again).
Dmitry

kosh
Posts: 72
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan
Contact:

Re: Call of (process ...) + from CGI problem under Win32

Post by kosh »

I've tried to create new process with the code below:
Code:

Code: Select all

(process "newlisp.exe my-proc.lsp")
Prease try the following code:

Code: Select all

(import "shell32.dll" "ShellExecuteA")
;; Open notepad.exe
;(ShellExecuteA 0 "open" "notepad.exe" "" 0 1)

(ShellExecuteA 0 "open" "newlisp.exe" "my-proc.lsp" 0 1)
;(ShellExecuteA 0 "open" "newlisp.exe" "my-proc.lsp" 0 0) ; with hidden console
On win32, ShellExecute function craetes a new process without waiting.
See also: http://msdn.microsoft.com/en-us/library ... 85%29.aspx

--- kosh

Locked