Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6
This is the forum to discuss the Wrox book Professional Microsoft Robotics Developer Studio by Kyle Johns, Trevor Taylor; ISBN: 9780470141076
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2008, 02:08 PM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Proper use of Arbiters

Hi,

I am reading through CH2 of the book, and I want to make sure I understand the use of Iterators and Arbiters:

1) If you want to call yeild return to suspend a thread from operation until a message is received, you need to place this call in an iterator wrapped function and declare an Arbiter.Receive as non-persistent. Then a delegate (or handler) is called upon reception and the receiver is destroyed.

2) Otherwise, if you want to always allow a receiver to exist, you can call it from a regular (i.e non-iterator wrapped function) using the Activate call (and assume the receiver is declared persistent), and this will allocate a seperate thread to handle the received messages.

Please let me know if I am understanding this correctly...

Thanks,
Scott

 
Old June 23rd, 2008, 08:06 PM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi,

For 1, yes you can only yield inside an Iterator. In fact, if you try to compile code with a yield statement in a normal method it will cause an error. If you were to yield to a persistent receiver, it would never finish.

In general, whether a receiver is non-persistent or not depends on your application. Maybe I did not quite understand your question.

For 2, usually you declare persistent receivers in an Interleave. This allows you to have exclusive handlers. If you just set up a bunch of persistent receivers separately then they can all run at the same time and you might have issues with concurrent access to data.

Activating a receiver does not allocate a thread directly. Dispatchers are responsible for assigning threads to tasks. You can however create your own dispatchers and specify the number of threads.

Activate can be a little confusing. When you call Activate you are using the CcrServiceBase.Activate method which hides the dispatcher queue from you. You can do the same thing using Arbiter.Activate, but then you have to specify the dispatcher queue.

Trevor







Similar Threads
Thread Thread Starter Forum Replies Last Post
ExecuteNonQuery not giving proper result Lalit Pradhan ASP.NET 2.0 Professional 6 July 24th, 2008 02:00 AM
Problem in view in proper order Somesh XML 0 March 5th, 2007 07:43 AM
tell me the proper free book name naveed77 Beginning VB 6 1 January 6th, 2007 11:31 AM
Proper Case IN Xsl Israr XSLT 8 April 4th, 2006 01:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.