Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th May 2012, 06:58   #1
samiz
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,
samiz is offline   Reply With Quote
Old 18th May 2012, 10:53   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 18th May 2012, 15:52   #3
Anders
Moderator
 
Anders's Avatar
 
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
Anders is offline   Reply With Quote
Old 29th May 2012, 04:50   #4
samiz
Junior Member
 
Join Date: Jun 2003
Posts: 10
Thanks for ur replies. Can I call macros in BGWorker (instead of functions).
samiz is offline   Reply With Quote
Old 29th May 2012, 08:38   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
Yes and no, macros work at compile time, not run time...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th May 2012, 08:42   #6
samiz
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,
samiz is offline   Reply With Quote
Old 29th May 2012, 10:47   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
The stack and/or registers will probably work...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th May 2012, 22:51   #8
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 644
Quote:
Originally Posted by samiz View Post
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)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 30th May 2012, 12:29   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 10th April 2013, 11:49   #10
samiz
Junior Member
 
Join Date: Jun 2003
Posts: 10
Cool 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?
samiz is offline   Reply With Quote
Old 11th April 2013, 00:45   #11
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
Maybe you could give us some more information? Example code?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 11th April 2013, 07:24   #12
samiz
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.
samiz is offline   Reply With Quote
Old 17th April 2013, 06:54   #13
samiz
Junior Member
 
Join Date: Jun 2003
Posts: 10
any soln?
samiz is offline   Reply With Quote
Old 19th April 2013, 07:59   #14
T.Slappy
Senior Member
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 364
Send a message via ICQ to T.Slappy
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/
T.Slappy is online now   Reply With Quote
Old 22nd April 2013, 10:53   #15
samiz
Junior Member
 
Join Date: Jun 2003
Posts: 10
Yes its happening on a particular machine. Otherwise works fine.
samiz is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Tags
execwait thread gui

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump