PC Review


Reply
Thread Tools Rate Thread

Asynchronous threading question

 
 
Pug Fugly
Guest
Posts: n/a
 
      18th May 2004
I have a function that takes in a parameter, and in the function it
calls the .BeginInvoke on the worker delegate. I know that the
System.AsyncCallback callback function takes in IAsyncResult as the
only parameter. But I have a case where I need to pass a parameter
from the function that calls the .BeginInvoke to my callback that
calls the .EndInvoke. Is this possible? Can I add another parameter
to my callback function, or is IAsyncResult the only parameter allowed
for the callback delegate?

Thanks,
Slavisa
 
Reply With Quote
 
 
 
 
Sven Groot
Guest
Posts: n/a
 
      18th May 2004
Pug Fugly wrote:
> I have a function that takes in a parameter, and in the function it
> calls the .BeginInvoke on the worker delegate. I know that the
> System.AsyncCallback callback function takes in IAsyncResult as the
> only parameter. But I have a case where I need to pass a parameter
> from the function that calls the .BeginInvoke to my callback that
> calls the .EndInvoke. Is this possible? Can I add another parameter
> to my callback function, or is IAsyncResult the only parameter allowed
> for the callback delegate?


Yes, it is the only parameter allowed, but you can use the AsyncState member
of the IAsyncResult interface to pass custom data. It's the third parameter
in the compiler-generated BeginInvoke method for your delegate.

--
Sven Groot

http://unforgiven.bloghorn.com

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Help needed with Asynchronous threading Stoitcho Goutsev \(100\) Microsoft Dot NET Framework Forms 0 18th Jan 2007 07:53 PM
Help needed with Asynchronous threading =?Utf-8?B?UGhpbGlw?= Microsoft Dot NET Framework Forms 0 18th Jan 2007 09:59 AM
Asynchronous Threading Help Pug Fugly Microsoft VB .NET 3 21st May 2004 04:26 PM
Asynchronous Sockets and Threading Darren Microsoft C# .NET 1 12th Nov 2003 08:51 AM
Asynchronous Sockets and Threading Darren Thomas Microsoft Dot NET 0 11th Nov 2003 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 PM.