|
|
#1 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
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, |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
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 Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
|
You could try http://nsis.sourceforge.net/BgWorker_plug-in but as Afrow said, not everything in NSIS is thread safe...
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
Thanks for ur replies. Can I call macros in BGWorker (instead of functions).
|
|
|
|
|
|
#5 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
|
Yes and no, macros work at compile time, not run time...
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
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, |
|
|
|
|
|
#7 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
|
The stack and/or registers will probably work...
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 644
|
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) My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
|
|
|
|
#9 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
He wants to use ExecWait but without blocking the window message loop.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
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? |
|
|
|
|
|
#11 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
|
Maybe you could give us some more information? Example code?
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
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. |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
any soln?
|
|
|
|
|
|
#14 |
|
Senior Member
|
There is no problem in the code you posted, it worked for me.
This code is not working only on some specific machine? Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jun 2003
Posts: 10
|
Yes its happening on a particular machine. Otherwise works fine.
|
|
|
|
![]() |
|
|||||||
| Tags |
| execwait thread gui |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|