Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #25778 > unrolled thread

Asynchronous programming using standard C

Started byChicken McNuggets <chicken@mcnuggets.com>
First post2012-09-02 23:28 +0100
Last post2012-09-03 11:43 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.c


Contents

  Asynchronous programming using standard C Chicken McNuggets <chicken@mcnuggets.com> - 2012-09-02 23:28 +0100
    Re: Asynchronous programming using standard C Nobody <nobody@nowhere.com> - 2012-09-03 03:09 +0100
      Re: Asynchronous programming using standard C Chicken McNuggets <chicken@mcnuggets.com> - 2012-09-03 11:43 +0100

#25778 — Asynchronous programming using standard C

FromChicken McNuggets <chicken@mcnuggets.com>
Date2012-09-02 23:28 +0100
SubjectAsynchronous programming using standard C
Message-ID<k20mi4$eg7$1@speranza.aioe.org>
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.

[toc] | [next] | [standalone]


#25792

FromNobody <nobody@nowhere.com>
Date2012-09-03 03:09 +0100
Message-ID<pan.2012.09.03.02.10.03.657000@nowhere.com>
In reply to#25778
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.

[toc] | [prev] | [next] | [standalone]


#25820

FromChicken McNuggets <chicken@mcnuggets.com>
Date2012-09-03 11:43 +0100
Message-ID<k221kk$6k8$1@speranza.aioe.org>
In reply to#25792
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web