How do I get an actor to wait for its nested actors to stop running before stopping itself?

I'm developing a series of projects that are based on the Actor Framework and my actor dependency hierarchy is starting to get some depth. One of the issues I'm facing now is making sure that each actor will only stop running (and signal this via a Last Ack to a higher-level actor or via a notification to non-AF code that launches it) once all of its nested actors have stopped running.
For instance, say I have a type of actor that handles communication with a microcontroller over USB - a USB Controller Actor. I might want to have an application-specific actor that launches USB Controller Actor to issue commands to the microcontroller. When shutting down, I want this top-level actor to send a Stop Msg to USB Controller Actor and then wait to receive a Last Ack back before sending a notification within a provided notifier to the non-AF application code, which can then finish shutting down completely.
I'm sure that having actors wait for all nested actors to shutdown before shutting down themselves is an extremely common requirement and I'm confident National Instruments have made it possible to handle that in a simple, elegant manner. I'm just struggling to figure out what that is.
The approaches I've experimented with are:
Creating a pseudo "Stop" message for an actor that won't actually stop it running straight away, but instruct it to stop all nested actors, wait for their Last Acks and then shut itself down by sending Stop Msg to itself. This isn't elegant because it means the client will be forced to fire off these pseudo stop messages instead of Stop Msg to certain actors.
Instantiating an internally-used notifier and overriding Stop Core.vi and Handle Last Ack Core.vi. The idea is that within Stop Core.vi, I send Stop Msg to each of the nested actors and then make it wait indefinitely on the internal notifier. Within Handle Last Ack Core.vi, I make it send a notification using this notifier which allows Stop Core.vi to continue and perform deinitialisation for the top-level actor itself. Figures 1 & 2 below show this approach. I wasn't confident that this would work since it assumed that it was possible for Stop Core.vi to execute and then Handle Last Ack Core.vi to concurrently execute some time after. These assumptions didn't hold and it didn't work. It would have been messy even if it had.
Overriding Stop Core.vi, making it send Stop Msg to each nested actor and then waiting for an arbitrarily long period of time (100ms, 200ms, etc.). What if a nested actor takes only 10ms to shut down? What if takes 400ms?
The figures below show how I implemented the second approach. Ignore the broken object wires - they only appear that way in the snippets.
Figure 1 - Stop Core.vi from the second approach
Figure 2 - Handle Last Ack Core.vi from the second approach

tst wrote:
It wasn't that hard to find - https://decibel.ni.com/content/thread/27138?tstart=0
But with dozens of posts, I have no intention of rereading it now.
Also, when crossposting, it's considered polite to add a link, so that people can see if the other thread has relevant replies.
Thanks. I've only read the first page for now but I find this interesting (I'm not sure how to format non-reply quotes, sorry):
 "AristosQueue wrote:
CaseyLamers1 wrote:
I think that this would be a nice addition. I think how a program stops is just as important as how it starts.
I think everyone who has worked on AF design agrees with this. Indeed, managing "Stop" was *the* thing that lead to the creation of the Actor Framework in the first place. The other issues (deadlock/hang avoidance and resource management) were secondary to just trying to get a clean shutdown.
CaseyLamers1 wrote:
I find the current code a bit lacking.
My concern would be that the mixing of a verified stop and a regular stop could create confusion and lead to people having trouble during editting and testing with the project ending up locked (due to VIs left running which did not shutting down).
Your concern is to some degree why no verified Stop exists in the AF already. We looked at each actor as an independent entity, and left it open to the programmer to add an additional managment layer for those applications that needed it. But over time, I have seen that particular management layer come up more often, which is why I am exploring the option."
So that gives one of the reasons why this hasn't already been implemented but also points out that it's something quite a lot of people want.
> Also, when crossposting, it's considered polite to add a link, so that people can see if the other thread has relevant replies.
Noted. Here's the discussion: https://decibel.ni.com/content/message/104983#104983
Edit: since there doesn't seem to be any NI-provided way of doing this yet, I suppose I'll try rolling my own at some point. The ideas posted in the discussion you linked seem pretty useful.

Similar Messages

  • How do I get rid of the 'Waiting for Activation' on IPhone 5?

    I got the iPhone 5 today and set everything up using my Apple ID I created for my Ipod Touch 5
    Under IMessage and FaceTime, it says it's 'waiting for activation'
    I can't receive any messages and would like to know hot to fix this

    http://support.apple.com/kb/TS4268

  • My computer shut down in the middle of downloading a movie rental and after restarting my computer, the rental was deleted. How do I get it back without paying for it again?

    my computer shut down in the middle of downloading a movie rental and after restarting my computer, the rental was deleted. How do I get it back without paying for it again?

    Reinstall OS X without erasing the drive
    1. Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. Reinstall Snow Leopard
    If the drive is OK then quit DU and return to the installer.  Proceed with reinstalling OS X.  Note that the Snow Leopard installer will not erase your drive or disturb your files.  After installing a fresh copy of OS X the installer will move your Home folder, third-party applications, support items, and network preferences into the newly installed system.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.

  • I had 21 songs i my album and after syncronising i only had 15 songs left! All of them from Itunes! How can i get them back without paying for them again???

    I had 21 songs i my album and after syncronising i only had 15 songs left! All of them from Itunes! How can i get them back without paying for them again???
    Hello!!!
    I had 21 songs i my album and after syncronising i only had 15 songs left! All of them from Itunes! How can i get them back without paying for them again???
    Hello!!!
    This realy works??

    Where is the backup of the media and other important files from the computer?  Ultimately, it is the users responsibility to ensure that backups exists. Waiting until there is a problem to decide to do a backup is not smart.  Would you wait until a fire started in your home to call the insurance company and inquire about homeowners/renters insurance????
    In the event that no backup exists (stop being lazy.... keep backups of YOUR data and other important files):
    If you are in the US and running iTunes 10.3 or later, it is possible to redownload music via iCloud from purchased history.
    If you are not in the US or for some reason cannot run iTunes 10.3 or later, contact iTunes customer support and ask very nicely for the opportunity to redownload the content.  They are not required to provide this opportunity.
    It is also possible to transfer content from an iDevice that was purchased via iTunes.  On the new computer, sign into the iTunes account, authorize the computer, connect the device then select File > Transfer Purchases.
    The simplest method of all is to transfer or copy the media (and other important files) from the old computer or the backup of the old computer.  Typing "move itunes library" into the search bar here or into google will reveal step by step instructions on how to do this.

  • How can I download a transfer without waiting for it be all transferred?

    How can I download a transfer without waiting for it be all transferred? Thanks.

    Thanks, that now makes sense. Once an item enters the download queue, the user cannot remove it. Either let it complete the download (easiest) or contact the iTunes Store customer support department through the Contact page (select the category and subcategory closest to the issue you're reporting and you'll find either an "Express Lane" button - just follow the instructions to get to the contact form - or an "Email Us" button) and ask them if they'll remove the item(s) from your queue for you.
    Regards.

  • How can I get the iCloud/iTunes password for my (now) deceased Father-in-Law's Imac?  I have a list of his passwords, but nothing works!

    How can I get the iCloud/iTunes password for my (now) deceased Father-in-Law's iMac?  I have a list of his passwords, but nothing works!  I know his email, but that account has been cancelled for security purposes, so we can't just request a new one.  I tried his security questions to no avail.
    Thanks

    Since that password is tied to his Apple ID, you will need to contact Apple; as far as I know, it will be a somewhat lengthy procedure and you will  need to furnish necessary paperwork (including a death certificate as far as I know). Best to either stop at an Apple store or call them to find out exactly what it is you need to do.

  • Itunes account is under a comcast address along with all my 800  tunes, my .me address is not connected to the music.  how do I get itunes match to work for my iphone

    itunes account is under a comcast address along with all my 8000 +  tunes, my .me address is not connected to the music.  how do I get itunes match to work for my iphone

    U.S. Cellular does not unlock iPhones: iPhone: Wireless carrier support and features - Apple Support
    Sell the iPhone to someone that wants to use U.S. Cellular, and use the proceeds to purchase an iPhone that is usable on the wireles carrier you prefer.

  • How do i get a new phone software for my nokia N97

    how do i get a new phone software for my nokia N97

    Check ovi suite for an update thats the only way
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • How do I get a new icloud account for my phone when it was setup with my wifes account?

    How do I get a new icloud account for my phone when it was setup with my wifes account?

    Go to Settings>iCloud and sign out. Any synced data, such as calendars and contacts, will be removed.
    To get a new ID: go to http://appleid.apple.com and create a new ID - you will need a different non-Apple email address from any ID you already have.
    Then go back to Settings>iCloud and sign in there, enabling any data types you want to sync in the list there. You will be asked to create a new @icloud.com address when enabling Mail.

  • Okay, so my friends music downloaded to my iPhone when i put it on his computer to charge and i re-synced it to mine and all his music is still there but blank and wont play how can i get it off of my phone, its so annoying!!

    Okay, so my friends music downloaded to my iPhone when i put it on his computer to charge and i re-synced it to mine and all his music is still there but blank and wont play how can i get it off of my phone, its so annoying!! My itunes only has like 4 songs because my computer crashed and lost all my songs, and I'm not trying to steal his music. But like I said its still in the music app on the phone but its all blank and wont play. I just want it off.

    When he plugs it into his Mac again, he should be asked if he wishes to sync with that Mac.

  • I have a macbook pro. I had iphoto on it prior to my hard drive crashing.  Hard drive was replaced but iphoto is no longer on. How do I get it back without paying for it?

    I have a macbook pro. I had iphoto on it prior to my hard drive crashing.  Hard drive was replaced but iphoto is no longer on. How do I get it back without paying for it?

    Have you tried
    http://support.apple.com/kb/HT4928

  • On my HP printer Officejet4620 I get an error message "waiting for printer to become available".  Help please?

    On my HP printer Officejet4620 I get an error message "waiting for printer to become available".  Help please?

    Restart the computer and restart the printer. If you continue to have the problem the follow the steps Apple outlines in Reset Printing System feature article.

  • I have a i-phone 5s which i got recently. Everytime i try to update my apps that i got on my 4s on the new5s i get message to fill in a password for some unknown gmail id. How do I get my  apple id back for my apps?

    I have a i-phone 5s which i got recently. Everytime i try to update my apps that i got on my 4s on the new5s i get message to fill in a password for some unknown gmail id. How do I get my  apple id back for my apps?

    That means that one or more of these apps was obtained using that ID. All apps are forever tied to the ID used to originally obtain them & they cannot be transferred to another ID. Your only option is to delete this content, then re-purchase using your ID.

  • How Can I get Interview Questions and answers for Oracle9i DBA and PL/SQL

    How Can I get Interview Questions and answers for Oracle9i DBA and PL/SQL Programmer.

    Please check the following link.
    http://www.geekinterview.com/
    -aijaz

  • How can I get the template( word rtf )  for PO – Printed Purchase Order ?

    I want to convert the “PO - Printed Purchase Order” report from Oracle rdf format to BI Publisher. I am looking for the template but could not find in UNIX.
    As per the Oracle blog, the template is available. Please see the URL : https://blogs.oracle.com/xmlpublisher/resource/121BIPReports.pdf
    The template code is POXPRPOL_XML.rtf
    when I look at the $PO_TOP/patch/115/publisher/templates/US directory, I cannot find POXPRPOL_XML.rtf
    How can I get the template( word rtf ) for PO – Printed Purchase Order ?
    Thank you,
    Biju Varghese.

    How can I get the template( word rtf ) for PO – Printed Purchase Order ? XML Publisher Administrator -> Templates
    find by code or name
    open it and you can downloadtemplate by "download" button

Maybe you are looking for

  • I want to move a pst file from Outlook to Entourage

    So far, all I can find out is that I need to have an account on a server running Exchange. I do not have this server so am wondering if there is an 'easy' way to work with Outlook to get my old emails brought across by file. Thanks for any help that

  • Page not rendering properly in Firefox

    Hi I'm new to Dreamweaver. I created this background for my website,  when I view it in DW design mode, it looks like the way I want but when I view in Firefox, the top section disappeard Could anyone please tell me why this is happening? Thanks you.

  • Using Java Servlet with CSV

    Hello!! I would be obliged if some one could tell me anyway of using CSV (Collaborative Source Versioning) with Java Servlets. I have searched and the only package that I have found is jCSVSlet but I can't figure out how to use it. I would be obliged

  • External debugging of ABAP from NWDS in web dynpro java

    Hello Experts, Like a while a ago, I remember on SDN there was a video for external debugging tutorial. Can any one point me to that or any other documentation for doing external debug from NWDS. Thanks, Sharath

  • Problem communication with Web Service

    Hello, today i've got a really illogical error. I will try to explain: I have got a procedure, which connect with a web service. The Code of this function is: °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°