Archive: ExecWait in separate thread


ExecWait in separate thread
Hi,

My installer does heavy processing/DB interaction by calling a separate exe. I am using ExecWait to call that exe but the issue is that NSIS installer GUI shows 'Not Responding' in its title bar after some time (specially if you click once or twice on NSIS UI). Can I call ExecWait so that it does not block NSIS GUI thread?

Thanks,


First you should specify why you are performing a lengthy process execution in page callbacks? Are you modifying the database? If so then you should be doing this in a Section. The user's machine should never be modified until they have clicked Install.

If you must run it before the user clicks Install then you are out of luck. NSIS does not support threading as its instructions are not atomic - they will not work correctly in multiple threads (trust me I have tried).

Are you displaying a Banner while it does its work? The installer may become unresponsive but a Banner will still display a message.

Stu


You could try http://nsis.sourceforge.net/BgWorker_plug-in but as Afrow said, not everything in NSIS is thread safe...


Thanks for ur replies. Can I call macros in BGWorker (instead of functions).


Yes and no, macros work at compile time, not run time...


I want to pass parameters to that function. Previously I had done it using macros. Any idea how to do this in BGWorker case?

Thanks,


The stack and/or registers will probably work...


Originally posted by samiz
Can I call ExecWait so that it does not block NSIS GUI thread?
If you want a non-blocking version of ExecWait(), why not simply use Exec()?

Am I right that you want to create the process asynchronously and then wait for its termination at a later point?

In that case ExecShellWait() from my StdUtils plug-in may be possible way to go:
http://nsis.sourceforge.net/StdUtils...#ExecShellWait

(It splits creating the process and waiting for its termination into two separate commands)

He wants to use ExecWait but without blocking the window message loop.

Stu


BgWorker not working
Hi,

I had successfully incorporated bgworker::callandwait in my code but on one machine (win 7 32 bit) the method I pass isnt being called.

This is happening on a specific machine only.

Any idea why?


Maybe you could give us some more information? Example code?


Function ConfigurationStart
GetFunctionAddress $0 Extract
messagebox mb_ok "$0"
BgWorker::CallAndWait
messagebox mb_ok "done"
FunctionEnd


Function Extract
messagebox mb_ok "Extracting..."
FunctionEnd


This is sample code which I am using. "Extracting..." never gets displayed.


any soln?


There is no problem in the code you posted, it worked for me.
This code is not working only on some specific machine?


Yes its happening on a particular machine. Otherwise works fine.