--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
>> Start should return as soon as possibleI keep getting bitten by this. I've started using TAP style code to avoid it, like this:public async void Start(){// Because this is async, the Start() method returns immediately and the SCM is happyawait StartDoingSomething();}private Task StartDoingSomething(){return Task.Factory.StartNew(() =>{// off we go}}RegardsStuartps If looks like if you copy text (even a single space) from Visual Studio using Remote Desktop on OSX and paste into a compose window in Gmail, Safari 6.0.5 dies every single time (on my macbook which is running Lion, anyway!)On 5 August 2013 17:54, Chris Patterson <ch...@phatboyg.com> wrote:
Your service should stick to handling Start/Stop, and let Topshelf deal with any exceptional conditions that occur in background threads. If you're using the TPL, fortunately you are immune from the unhandled exception and just have to deal with the exception not observed if you're on 4.0 with the default behavior.That being said, Start should return as soon as possible, or call the RequestAdditionalTime() method on the HostControl argument to avoid getting killed by the SCM. And your service should START, meaning that the Start method should return and any service related functions be on other threads. For example, using something like MassTransit gives you a separate thread pool for consuming messages, so no additional work here is needed since MT does its own thread management.On Mon, Aug 5, 2013 at 6:53 AM, Travis Smith <tra...@legomaster.net> wrote:
If you're TPL, I would just check for a cancel event, and in the shutdown activate the cancel event.An example Topshelf service I have has the following in start (with types added)// load app config stuff...(Task)_orphanCleanup = (TaskFactory)_taskFactory.StartNew(DiscoverOrphanedAndAgedMetrics);