Page 1 of 1

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

Posted: Wed Mar 31, 2010 10:40 am
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?

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

Posted: Wed Mar 31, 2010 12:06 pm
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.

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

Posted: Wed Mar 31, 2010 12:41 pm
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).

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

Posted: Sat Apr 03, 2010 1:41 pm
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