Does C/C++ provide something like "event".

  • Thread starter lovecreatesbeauty
  • Start date
L

lovecreatesbeauty

Hello,


I want to know whether programming languages such as C or C++ provide
something like "event".

In function "f1", a handler/function "h2" is triggered. But f1 won't be
blocked by h2, f1 can execute the next task and no need to wait for
h2's return.

Does this characteristic only provided by OS like Ms Windows or Linux?


Sincerely
lovecreatesbeauty
 
W

Walter Roberson

:I want to know whether programming languages such as C or C++ provide
:something like "event".

Not as you have described it, no.

:In function "f1", a handler/function "h2" is triggered. But f1 won't be
:blocked by h2, f1 can execute the next task and no need to wait for
:h2's return.

Asynchronous execution implies one of:
- multiple CPUs
- timer-driven context switching
- cooperative multitasking
- multiple threads

None of these are considered to be requirements for either C or C++.

C in particular has defined minimal behaviours for embedded systems
that might be lacking many of the facilities you are accustomed to
in a programming language.

As far as C and C++ are concerned, those alternatives are hardware
or OS dependant, and thus not suitable candidates for standardization
as part of the language itself.


:Does this characteristic only provided by OS like Ms Windows or Linux?

Threading in particular is standardized by POSIX as a library that
one can *call* from C or C++, if one's execution environment happens
to support it. A -lot- of useful features are defined as various
standardized libraries that might or might not be present on your
Apple //e's Z80 expansion card. The C and C++ languages do not
*require* these libraries: they simply provide facilities for linking
to such libraries.

Let me add another example for particular emphasis:

ANSI standard C (C89) doesn't even define open(), just fopen().
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top