- NSIS Discussion
- ExecWait in separate thread
Archive: ExecWait in separate thread
samiz
18th May 2012 07:58 UTC
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,
Afrow UK
18th May 2012 11:53 UTC
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
Anders
18th May 2012 16:52 UTC
You could try http://nsis.sourceforge.net/BgWorker_plug-in but as Afrow said, not everything in NSIS is thread safe...
samiz
29th May 2012 05:50 UTC
Thanks for ur replies. Can I call macros in BGWorker (instead of functions).
Anders
29th May 2012 09:38 UTC
Yes and no, macros work at compile time, not run time...
samiz
29th May 2012 09:42 UTC
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,
Anders
29th May 2012 11:47 UTC
The stack and/or registers will probably work...
LoRd_MuldeR
29th May 2012 23:51 UTC
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)
Afrow UK
30th May 2012 13:29 UTC
He wants to use ExecWait but without blocking the window message loop.
Stu
samiz
10th April 2013 12:49 UTC
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?
Anders
11th April 2013 01:45 UTC
Maybe you could give us some more information? Example code?
samiz
11th April 2013 08:24 UTC
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.
samiz
17th April 2013 07:54 UTC
any soln?
T.Slappy
19th April 2013 08:59 UTC
There is no problem in the code you posted, it worked for me.
This code is not working only on some specific machine?
samiz
22nd April 2013 11:53 UTC
Yes its happening on a particular machine. Otherwise works fine.