Async Methods, Callback (What Thread)

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

    #1

    Async Methods, Callback (What Thread)

    hello

    I have implemented a solution using async methods. There is one async
    method that can be invoked multiple times, ie there are multiple async
    "threads" running at a time.

    When these threads are complete, the call the Callback method. Each "thread"
    calls the same callback method.

    What thread does this callback method exist on? My testing indicates the
    callback method is not blocked when executed from a given thread when it
    completes.

    For example thread 1 can execure it's callback , while thread 2 executes
    it's callback. No blocking seems to occur.

    Any help getting me to understand this would be appreciated.


  • Peter Huang [MSFT]

    #2
    RE: Async Methods, Callback (What Thread)

    Hi Scott,

    I think the CallBack function is reentrant, i.e. each thread that calls the
    callback function will have its own function call back stack. Therefore the
    this callback method exist on every thread that call the function. If you
    want to program multithread application, you may need to synchronize the
    data that will be access by the callback function.

    Here is a link about Synchronizing Data for Multithreading.
    http://msdn.microsoft.com/library/de...us/cpguide/htm
    l/cpconmanagedthr eadingsupport.a sp


    Regards,
    Peter Huang
    Microsoft Online Partner Support
    Get Secure! www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    --------------------[color=blue]
    >From: "scott ocamb" <socamb@hotmail .com>
    >Subject: Async Methods, Callback (What Thread)
    >Date: Fri, 8 Aug 2003 13:02:56 -0400
    >Lines: 19
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <eDvK#6cXDHA.14 80@tk2msftngp13 .phx.gbl>
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >NNTP-Posting-Host: 64.241.196.2
    >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:103985
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >hello
    >
    >I have implemented a solution using async methods. There is one async
    >method that can be invoked multiple times, ie there are multiple async
    >"threads" running at a time.
    >
    >When these threads are complete, the call the Callback method. Each[/color]
    "thread"[color=blue]
    >calls the same callback method.
    >
    >What thread does this callback method exist on? My testing indicates the
    >callback method is not blocked when executed from a given thread when it
    >completes.
    >
    >For example thread 1 can execure it's callback , while thread 2 executes
    >it's callback. No blocking seems to occur.
    >
    >Any help getting me to understand this would be appreciated.
    >
    >
    >[/color]

    Comment

    Working...