COM pricesUpdated.invoke() threads

Please post any questions regarding the program here.

Moderator: 2020vision

COM pricesUpdated.invoke() threads

Postby laffo16 » Fri Feb 26, 2016 11:55 pm

Hello!

I've been experimenting with running multiple COM instances refreshing at 0.2 and hooking onto the pricesUpdated event. When running just a single COM instance everything appears hunky dory, but as i gradually added more COM instances I encountered a cascading delay effect in the response of getPrices(). I stripped everything away and created a test bed to further investigate this (see attached solution below).

This is only my best guess so I may be well off here, feel free to correct me. But I believe that pricesUpdated is called via .Invoke() which means that betting assistant will wait for my hook on the event to return before continuing its completion of that thread. I came to this assumption by adding a Thread.Delay() into my hooked method of pricesUpdated(), now this is only for the purposes of demonstration, the problem is if my hooked method doesn't return for whatever reason this will cause many threads to be queued within betting assistant which has the knock-on effect of causing any other COM activity to be severely delayed.

I ask, if this is the case, would it be possible to change the invoke of pricesUpdated delegate to instead .BeginInvoke()? which means betting assistant would continue without waiting, thus there would be no chance of a thread overload occurring.

I can understand if you don't see this as an issue and I'm sure I could better handle the hook to avoid any delayed returns but as pricesUpdated returns void anyways I figured I would ask.

PricesUpdated Test Solution (visual studio 2012)
http://s000.tinyupload.com/?file_id=159 ... 9011349748

Here is the threads going out of control if the pricesUpdated hook doesn't return quickly, causing getPrices() to return slowly.

http://i.imgur.com/FtEJcZ4.jpg?1

Thanks for anyhelp!
User avatar
laffo16
 
Posts: 172
Joined: Sun Jan 27, 2008 6:52 pm

Return to Help

Who is online

Users browsing this forum: No registered users and 18 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.