none
High efficiency async IO RRS feed

  • Question

  • After many weeks I have arrived at a stable, clean and reliable model for implementing a proprietary messaging protocol using async network IO.

    The code (a class named "Channel") allows either sync or async send/recv of single message or collections (IEnumerable or via an even callback).

    This is wroking well but I wanted to get feedback on something.

    Initially I used ThreadPool.RegisterWaitForSingleObject as the mechanism for managing worker and IO (async end) callback synchronization. For a bulk send this allowed the app-thread to queue a callback to begin the enumeration, with the enumeration worker queueing callbacks for idle timeouts and starting async sends. The completion of async sends (EndSend) then queueing worker callbacks to continue the enumeration, the whole operation using an internadiate ring buffer as the store for messages prior to transmission.

    This worked but as I reviewed the code very carefully I began to realize that I could simply use Threading.Timer instead, I have coded this up and it seems to run very well, and is simpler to understand and debug.

    Basically I create a Timer with timeouts of infinity, they thus never fire.

    Later as the code runs, these timers can have their Change method called, passing in zero for first arg. This acts like an event in that the respective callback is immediately called on another thread.

    This is simpler to code, I have a timer for calling back into the enumeration method and another for initiating async IO (also called if a partially filled ring buffer has been idle (not written to) for too long).

    So does anyone see a downside to doing this?

    I've not seen the "technique" used anywhere but it seems very neat and runs fine, less confusion and easier semantics.

     

    Cap'n

     

     

    Wednesday, December 15, 2010 6:12 PM

All replies

  • Hi Cap'n

     

    We’re doing research on this issue. It might take some time before we get back to you.

     

    Best Regards,


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 21, 2010 8:39 AM
  • Hi,

    Are you still seeing this issue?

    Issue requires a code review of how you have implemented this.

    Asynchronous IO is complex in the sense that we need to take a closer look of what really is going on at least a bare minimal repro is needed.

    To decipher what you are trying to explain, but could not fit everything together. Moreover this is not a break down issue. Asking whether what  was done will *reliably* work or not, for which we must need to look

    At the code.

     

    My recommendation would be to have you open a support incident with Microsoft support, and see if we can't get a repro they can review. You may have a few differant options for opening said support incident.

    Alliance and Premier VSIP membership includes a complimentary MSDN subscription, which includes 4 professional support incidents. These can be used to initialize a support request with Microsoft's Customer Support Services. Some versions of Visual Studio include a number of free support incidents as well. See the "Technical Support Incidents" topic for details.

     

    Your issue falls into a category that we are not able to resolve using the forums. There are various support options such as advisory and per issue. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    You can also submit feedback at Microsoft connect.

    https://connect.microsoft.com/

     


    bill boyce
    Friday, January 21, 2011 6:30 PM
    Moderator
  • Hi,

    Are you still seeing this issue?

    Issue requires a code review of how you have implemented this.

    Asynchronous IO is complex in the sense that we need to take a closer look of what really is going on at least a bare minimal repro is needed.

    To decipher what you are trying to explain, but could not fit everything together. Moreover this is not a break down issue. Asking whether what  was done will *reliably* work or not, for which we must need to look

    At the code.

     

    My recommendation would be to have you open a support incident with Microsoft support, and see if we can't get a repro they can review. You may have a few differant options for opening said support incident.

    Alliance and Premier VSIP membership includes a complimentary MSDN subscription, which includes 4 professional support incidents. These can be used to initialize a support request with Microsoft's Customer Support Services. Some versions of Visual Studio include a number of free support incidents as well. See the "Technical Support Incidents" topic for details.

     

    Your issue falls into a category that we are not able to resolve using the forums. There are various support options such as advisory and per issue. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    You can also submit feedback at Microsoft connect.

    https://connect.microsoft.com/

     


    bill boyce


    Hi

    This never was an issue or a problem, it was just a technical question about whether using a Timer in this way has a downside, the code works fine and runs very well now, but I wanted to know if my unorthodox use of a Timer as an event mechanism was risky or not.

    Thanks

    Cap'n

     

    Saturday, January 22, 2011 7:20 PM