<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx</link><description>In the last post of the series, we’ve taken a look at the main features offered by the event based pattern. Today, we’re going to look at how we can implement that pattern. We’re going to start small and we’re going to reuse the IAsyncResult sample for</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1734607</link><pubDate>Fri, 23 Oct 2009 18:15:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1734607</guid><dc:creator>luisabreu</dc:creator><description>&lt;p&gt;Sorry for the late reply, but i&amp;#39;ve been a little busy.&lt;/p&gt;
&lt;p&gt;please disregard my last comment because i didn&amp;#39;t understand the question...&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still not sure if you want to 1.) stop the current processing when the a new event arrives or 2.) you don&amp;#39;t want to stop the current processing when another event arrives.&lt;/p&gt;
&lt;p&gt;if you want 2, then you can use a collection where you have producers and consumers (ie, you can have several threads putting stuff there and others removing). I think I&amp;#39;ve written a post on it a long time ago...&lt;/p&gt;
&lt;p&gt;if it&amp;#39;s 2, then you&amp;#39;ll have to keep looking for new objects in the queue. when it&amp;#39;s there you&amp;#39;ll have to stop the current action (probably use some sort of compensation for cancelling it before starting the new one?)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1734607" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733957</link><pubDate>Wed, 21 Oct 2009 12:19:12 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733957</guid><dc:creator>Irfan</dc:creator><description>&lt;p&gt;Didn&amp;#39;t get your point. Can you elaborate it a bit? Thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733957" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733926</link><pubDate>Wed, 21 Oct 2009 10:21:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733926</guid><dc:creator>luisabreu</dc:creator><description>&lt;p&gt;Wouldn&amp;#39;t you be better by using some sort of compensation mechanism instead of enforcing &amp;quot;real time&amp;quot; handling of an action? &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733926" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733920</link><pubDate>Wed, 21 Oct 2009 09:11:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733920</guid><dc:creator>Irfan</dc:creator><description>&lt;p&gt;Yes, if the thread that have registered events of the asyncmethod is busy in executing business actions of an event and meanwhile another event is raised from the asyncmethod, that stops the previous event and starts the new event business execution. &lt;/p&gt;
&lt;p&gt;So if I don&amp;#39;t use this pattern then how to achieve event driven programming in a multi-threaded application?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733920" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733912</link><pubDate>Wed, 21 Oct 2009 08:32:21 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733912</guid><dc:creator>luisabreu</dc:creator><description>&lt;p&gt;I&amp;#39;d say no. the event pattern should be used essentially in UI scenarios, where you need to make sure that the callback method is executed back in the some thread which started the async call. it looks like this is not the scenario you&amp;#39;ve got, so I&amp;#39;d say you won&amp;#39;t be gaining much from using it.&lt;/p&gt;
&lt;p&gt;btw, i&amp;#39;m still not sure in what&amp;#39;s the problem you&amp;#39;re facing when receiving a new event. are you saying that you can&amp;#39;t just have another thread do something if currently there&amp;#39;s a business action going on as a result of a previous event?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733912" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733891</link><pubDate>Wed, 21 Oct 2009 06:57:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733891</guid><dc:creator>Irfan</dc:creator><description>&lt;p&gt;I need to develop a network application that consists of two modules. One need to handle the clients, i.e., send/receive requests/data from clients and the other module need to handle the business logic for different requests. Now I want to execute the clients management module in a separate thread and generate events in response of clients requests. The other module that implements the business logic will subscribe to these events and perform corresponding actions in response to the events raised. Now the problem is if an event is raised from client management module and business logic layer is executing the request. Mean while if another event is raised, current event is interrupted and the new event starts executing. So I need a solution to avoid this problem. One way is to implement my own queue management system that queues events when raised and forward to business layer when it becomes idle. So my question is should I use event based pattern in this scenario or it is not suitable in this case? If yes i should use, then what about the problem i have mentioned, how to handle it?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733891" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733623</link><pubDate>Tue, 20 Oct 2009 09:48:52 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733623</guid><dc:creator>luisabreu</dc:creator><description>&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not following you. can you be a lilttle more specific please? thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733623" width="1" height="1"&gt;</description></item><item><title>re: Multithreading: implementing the event based pattern</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1733605</link><pubDate>Tue, 20 Oct 2009 08:13:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1733605</guid><dc:creator>Irfan</dc:creator><description>&lt;p&gt;Can you explain how to handle the scenario where the callbacks generation speed of the async event class is greater than the consuming thread (console based application where no queuing mechanism is implemented by default). Currently I am locking the consuming thread using lock(this){ event handler } to solve this issue. Is this a valid approach? Or the event based asynchronous model is not valid approach in this scenario?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1733605" width="1" height="1"&gt;</description></item><item><title>Для  тестирования нового вэб-проекта, требуются  :</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1697498</link><pubDate>Wed, 01 Jul 2009 16:27:55 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1697498</guid><dc:creator>GreenCard</dc:creator><description>&lt;p&gt;Для тестирования нового большого вэб-проекта,и выявления багов,набирается тест-группа, &amp;nbsp;50 человек.&lt;/p&gt;
&lt;p&gt;Для участия в тестировании необхдим персональный компьютер подключенный к быстрому &lt;/p&gt;
&lt;p&gt;интернету. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Каждому тестировщику будет посланы задачи и суть теста.&lt;/p&gt;
&lt;p&gt;Тестирование не требует особых знаний компьютера или програмирования!&lt;/p&gt;
&lt;p&gt;На компютере не будет устанавливатся какая либо программа, и нету использования вашего трафика.&lt;/p&gt;
&lt;p&gt;Тестирование в свободное время.&lt;/p&gt;
&lt;p&gt;Участие в проекте допустимо лицам выше 16-лет.&lt;/p&gt;
&lt;p&gt;Условия участия, оплата, инструктаж, и &amp;nbsp;контакты будут посланы по востребованию.&lt;/p&gt;
&lt;p&gt;Для участия необходимы программы : Skype/Скайп или Айсикью/ ICQ .&lt;/p&gt;
&lt;p&gt;Местоположение тестировщиков - значения не имеет.&lt;/p&gt;
&lt;p&gt;Заявки посылать на эл.адрес &amp;nbsp;webp2010@gmail.com&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1697498" width="1" height="1"&gt;</description></item><item><title>Multithreading: updating the code to support multiple asynchronous executions of one method</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1695916</link><pubDate>Sat, 20 Jun 2009 14:35:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1695916</guid><dc:creator>ASPInsiders</dc:creator><description>&lt;p&gt;In the previous posts, we’ve seen how to implement the asynchronous event based pattern and how to support&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1695916" width="1" height="1"&gt;</description></item><item><title>Multithreading: updating the code to support multiple asynchronous executions of one method</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1695914</link><pubDate>Sat, 20 Jun 2009 14:26:44 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1695914</guid><dc:creator>LA.NET [EN]</dc:creator><description>&lt;p&gt;In the previous posts, we’ve seen how to implement the asynchronous event based pattern and how to support&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1695914" width="1" height="1"&gt;</description></item><item><title>Multithreading: implementing the event based pattern - LA.NET [EN]</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/06/17/multithreading-implementing-the-event-based-pattern.aspx#1695753</link><pubDate>Thu, 18 Jun 2009 02:25:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1695753</guid><dc:creator>9eFish</dc:creator><description>&lt;p&gt;9efish.感谢你的文章 - Trackback from 9eFish&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1695753" width="1" height="1"&gt;</description></item></channel></rss>