Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create my own asynchronous BeginXXXX methods and EndXXXX methods

1 view
Skip to first unread message

Varangian

unread,
May 15, 2008, 10:58:30 AM5/15/08
to
Hello,

the subjects says much I think.

Basically I want to create my own long running tasks asynchronously.
I want to have a BeginMyOwnLongTediousMethod
and EndMyOwnLongTediousMethod

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

Is there any way I can do my own?

Thanks!!!

Peter Duniho

unread,
May 15, 2008, 11:36:19 AM5/15/08
to
On Thu, 15 May 2008 07:58:30 -0700, Varangian <ofm...@gmail.com> wrote:

> Basically I want to create my own long running tasks asynchronously.
> I want to have a BeginMyOwnLongTediousMethod
> and EndMyOwnLongTediousMethod
>
> You know like the framework already has the methods of
> BeginExecuteReader 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 BackgroundWorker).

Pete

Varangian

unread,
May 15, 2008, 4:14:35 PM5/15/08
to
Yes thanks. but why I can't find any example on the internet?!

Jeremy Shovan

unread,
May 15, 2008, 4:46:07 PM5/15/08
to
Here is a walkthrough that you can use.

http://msdn.microsoft.com/en-us/library/bz33kx67.aspx

Jeremy Shovan

"Varangian" <ofm...@gmail.com> wrote in message
news:af2009d6-615e-4a9c...@24g2000hsh.googlegroups.com...

Peter Duniho

unread,
May 15, 2008, 9:07:19 PM5/15/08
to
On Thu, 15 May 2008 13:14:35 -0700, Varangian <ofm...@gmail.com> wrote:

> 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

0 new messages