Create my own asynchronous BeginXXXX methods and EndXXXX methods

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Varangian

    Create my own asynchronous BeginXXXX methods and EndXXXX methods

    Hello,

    the subjects says much I think.

    Basically I want to create my own long running tasks asynchronously.
    I want to have a BeginMyOwnLongT ediousMethod
    and EndMyOwnLongTed iousMethod

    You know like the framework already has the methods of
    BeginExecuteRea der that return an IAsynchResult.

    Is there any way I can do my own?

    Thanks!!!
  • Peter Duniho

    #2
    Re: Create my own asynchronous BeginXXXX methods and EndXXXX methods

    On Thu, 15 May 2008 07:58:30 -0700, Varangian <ofmars@gmail.c omwrote:
    Basically I want to create my own long running tasks asynchronously.
    I want to have a BeginMyOwnLongT ediousMethod
    and EndMyOwnLongTed iousMethod
    >
    You know like the framework already has the methods of
    BeginExecuteRea der that return an IAsynchResult.
    >
    Is there any way I can do my own?
    Yes, of course.

    Start here:
    Learn about the Asynchronous Programming Model (APM) in .NET. Discover how to begin and end an asynchronous operation.


    Read that page, and follow the various links that relate to implementing
    your own asynchronous API.

    Keep in mind that you may find that it's simpler to, rather than add an
    asynchronous API to your own classes, just use your classes from an
    existing asynchronous mechanism in .NET (such as using BackgroundWorke r).

    Pete

    Comment

    • Varangian

      #3
      Re: Create my own asynchronous BeginXXXX methods and EndXXXX methods

      Yes thanks. but why I can't find any example on the internet?!

      Peter Duniho wrote:
      On Thu, 15 May 2008 07:58:30 -0700, Varangian <ofmars@gmail.c omwrote:
      >
      Basically I want to create my own long running tasks asynchronously.
      I want to have a BeginMyOwnLongT ediousMethod
      and EndMyOwnLongTed iousMethod

      You know like the framework already has the methods of
      BeginExecuteRea der that return an IAsynchResult.

      Is there any way I can do my own?
      >
      Yes, of course.
      >
      Start here:
      Learn about the Asynchronous Programming Model (APM) in .NET. Discover how to begin and end an asynchronous operation.

      >
      Read that page, and follow the various links that relate to implementing
      your own asynchronous API.
      >
      Keep in mind that you may find that it's simpler to, rather than add an
      asynchronous API to your own classes, just use your classes from an
      existing asynchronous mechanism in .NET (such as using BackgroundWorke r).
      >
      Pete

      Comment

      • Jeremy Shovan

        #4
        Re: Create my own asynchronous BeginXXXX methods and EndXXXX methods

        Here is a walkthrough that you can use.

        Learn more about: How to: Implement a Component That Supports the Event-based Asynchronous Pattern


        Jeremy Shovan

        "Varangian" <ofmars@gmail.c omwrote in message
        news:af2009d6-615e-4a9c-8fd0-a9e386a103b1@24 g2000hsh.google groups.com...
        Yes thanks. but why I can't find any example on the internet?!
        >
        Peter Duniho wrote:
        >On Thu, 15 May 2008 07:58:30 -0700, Varangian <ofmars@gmail.c omwrote:
        >>
        Basically I want to create my own long running tasks asynchronously.
        I want to have a BeginMyOwnLongT ediousMethod
        and EndMyOwnLongTed iousMethod
        >
        You know like the framework already has the methods of
        BeginExecuteRea der that return an IAsynchResult.
        >
        Is there any way I can do my own?
        >>
        >Yes, of course.
        >>
        >Start here:
        >http://msdn.microsoft.com/en-us/library/ms228963.aspx
        >>
        >Read that page, and follow the various links that relate to implementing
        >your own asynchronous API.
        >>
        >Keep in mind that you may find that it's simpler to, rather than add an
        >asynchronous API to your own classes, just use your classes from an
        >existing asynchronous mechanism in .NET (such as using BackgroundWorke r).
        >>
        >Pete

        Comment

        • Peter Duniho

          #5
          Re: Create my own asynchronous BeginXXXX methods and EndXXXX methods

          On Thu, 15 May 2008 13:14:35 -0700, Varangian <ofmars@gmail.c omwrote:
          Yes thanks. but why I can't find any example on the internet?!
          I'm not sure. I'm confident one exists, even if I don't personally know
          where it is exactly.

          Perhaps MSDN doesn't elaborate because they feel that someone who is
          qualified to implement the async design pattern in their class should have
          enough experience already to know how to do so. It's definitely not
          something for beginners.

          There are other ways to accomplish the same thing without introducing an
          async API in your class, and those ways are more suitable for someone who
          doesn't already have enough multi-threading programming experience to know
          how to implement the patterns described by MSDN.

          Pete

          Comment

          Working...