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

Started by gaidam, March 31, 2010, 03:40:48 AM

Previous topic - Next topic

gaidam

Hello,



I have some problem with concurrent processes under Win32.



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

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:

(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

#1
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

#2
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

#3
QuoteI've tried to create new process with the code below:

Code:
(process "newlisp.exe my-proc.lsp")


Prease try the following code:


(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/bb762153%28VS.85%29.aspx">//http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx



--- kosh