Asynchronous programming using standard C

Discussion in 'C Programming' started by Chicken McNuggets, Sep 2, 2012.

  1. I'm interested in asynchronous programming but am having a few problems
    understanding the underlying implementation.

    I assume that asynchronous programming is generally done by calling a
    function (which includes a call back function pointer in its arguments)
    which starts a thread and then immediately returns. Once the thread has
    completed the task it then calls the call back function to return the
    data to the caller.

    Is this the basic idea of asynchronous programming or have I got it
    completely wrong?

    Thankfully threading is now on-topic in this group thanks to C11.

    Thank you for any help.
    Chicken McNuggets, Sep 2, 2012
    #1
    1. Advertising

  2. Chicken McNuggets

    Nobody Guest

    On Sun, 02 Sep 2012 23:28:18 +0100, Chicken McNuggets wrote:

    > I assume that asynchronous programming is generally done by calling a
    > function (which includes a call back function pointer in its arguments)
    > which starts a thread and then immediately returns. Once the thread has
    > completed the task it then calls the call back function to return the
    > data to the caller.
    >
    > Is this the basic idea of asynchronous programming or have I got it
    > completely wrong?


    That is one specific example of an asynchronous system.

    Other examples might have the thread invoke the callback whenever
    something interesting happens, not just on completion, or might avoid the
    callback and have the initiator poll for updates. Or there may not be a
    separate thread, just an event-processing loop which invokes callbacks as
    events arrive (the callbacks are synchronous with respect to the
    event-dispatching function but asynchronous with respect to the code which
    installed them or which triggered the event).

    "Asynchronous" generally just means that code is structured to accept
    information as it becomes available rather than blocking until the
    information is provided.
    Nobody, Sep 3, 2012
    #2
    1. Advertising

  3. On 03/09/2012 03:09, Nobody wrote:
    > On Sun, 02 Sep 2012 23:28:18 +0100, Chicken McNuggets wrote:
    >
    >> I assume that asynchronous programming is generally done by calling a
    >> function (which includes a call back function pointer in its arguments)
    >> which starts a thread and then immediately returns. Once the thread has
    >> completed the task it then calls the call back function to return the
    >> data to the caller.
    >>
    >> Is this the basic idea of asynchronous programming or have I got it
    >> completely wrong?

    >
    > That is one specific example of an asynchronous system.
    >
    > Other examples might have the thread invoke the callback whenever
    > something interesting happens, not just on completion, or might avoid the
    > callback and have the initiator poll for updates. Or there may not be a
    > separate thread, just an event-processing loop which invokes callbacks as
    > events arrive (the callbacks are synchronous with respect to the
    > event-dispatching function but asynchronous with respect to the code which
    > installed them or which triggered the event).
    >
    > "Asynchronous" generally just means that code is structured to accept
    > information as it becomes available rather than blocking until the
    > information is provided.
    >


    Ah. Thanks for your response. That makes sense.
    Chicken McNuggets, Sep 3, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zebulon
    Replies:
    1
    Views:
    626
    Raymond DeCampo
    Jan 24, 2006
  2. Pierre Quentel
    Replies:
    2
    Views:
    323
    John J. Lee
    Jan 10, 2004
  3. Dustin J. Mitchell

    Standard Asynchronous Python

    Dustin J. Mitchell, Sep 10, 2012, in forum: Python
    Replies:
    7
    Views:
    359
    Bryan
    Sep 16, 2012
  4. Dennis Lee Bieber

    Re: Standard Asynchronous Python

    Dennis Lee Bieber, Sep 10, 2012, in forum: Python
    Replies:
    0
    Views:
    202
    Dennis Lee Bieber
    Sep 10, 2012
  5. Oscar Benjamin

    Re: Standard Asynchronous Python

    Oscar Benjamin, Sep 10, 2012, in forum: Python
    Replies:
    0
    Views:
    155
    Oscar Benjamin
    Sep 10, 2012
Loading...

Share This Page