Topic: keyword async
Author: jmoguill2@gmail.com
Date: Thu, 13 Nov 2014 18:48:08 -0800 (PST)
Raw View
------=_Part_326_18069949.1415933288133
Content-Type: text/plain; charset=UTF-8
Hello,
I have a proposal for a new c++ language feature. It's the keyword "async"
(asynchronous), which can be used to designate a function's intent
behavior.
Example:
class EventNotifier {
public:
virtual async bool notifyCallback(int event, int value) = 0; //async
keyword informs the implementer that the function's intended behavior is
asynchronous.
}
implementor:
class MyEventNotifier: public EventNotifier {
virtual async void notifyCallback(int event , int value) {
//don't block
return true;
}
}
In addition, when the application is compiled in debug mode, the compiler
can insert run-time checks to verify that the function indeed performs
asynchronously, by measuring the execution time of the function.
If it is larger than a threshold (example: 100 ms), than a warning can be
outputted to the programmer that the asynchronous function is blocking.
This will help to eliminate a common source of bugs: blocking of functions
that are supposed to be implemented as asynchronous .
pseudocode:
class MyEventNotifier: public EventNotifier {
virtual async void notifyCallback(int event , int value) {
time t0 = now(); //inserted by compiler
//don't block
time t1 = now() - t0; //inserted by compiler
if ((t1 - t0) > 100) { WARNING("Async function blocked for 100 ms"); }
//inserted by compiler
return true;
}
}
-Jeff
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_326_18069949.1415933288133
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello,<div>I have a proposal for a new c++ language featur=
e. It's the keyword "async" (asynchronous), which can be used to desi=
gnate a function's intent behavior. </div><div>Example: </div><d=
iv><br></div><div>class EventNotifier {</div><div>public:</div><div> =
virtual async bool notifyCallback(int event, int value) =3D 0; //async keyw=
ord informs the implementer that the function's intended&nbs=
p;behavior is asynchronous. </div><div>}</div><div><br></div><div>imp=
lementor:</div><div><br></div><div>class MyEventNotifier: public EventNotif=
ier {</div><div> virtual async void notifyCallback(int event , int va=
lue) {</div><div> //don't block</div><div> return=
true;</div><div> }</div><div>}</div><div><br></div><div>In addition, =
when the application is compiled in debug mode, the compiler can insert run=
-time checks to verify that the function indeed performs asynchronously, by=
measuring the execution time of the function.</div><div>If it is larger th=
an a threshold (example: 100 ms), than a warning can be outputted to the pr=
ogrammer that the asynchronous function is blocking.</div><div>This will he=
lp to eliminate a common source of bugs: blocking of functions that are sup=
posed to be implemented as asynchronous .</div><div><br></div><div>pseudoco=
de:</div><div><br></div><div><div>class MyEventNotifier: public EventNotifi=
er {</div><div> virtual async void notifyCallback(int event , int val=
ue) {</div><div> time t0 =3D now(); //inserted by compiler</di=
v><div> //don't block</div><div> time t1 =3D now(=
) - t0; //inserted by compiler</div><div> if ((t1 - t0) > 1=
00) { WARNING("Async function blocked for 100 ms"); } //inserted by c=
ompiler</div><div> return true;</div><div> }</div><div>}<=
/div></div><div><br></div><div>-Jeff</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_326_18069949.1415933288133--
.
Author: german.gomez@personifyinc.com
Date: Thu, 13 Nov 2014 20:20:22 -0800 (PST)
Raw View
------=_Part_384_521773334.1415938822706
Content-Type: text/plain; charset=UTF-8
On Friday, November 14, 2014 9:48:08 AM UTC+7, jmog...@gmail.com wrote:
>
> Hello,
> I have a proposal for a new c++ language feature. It's the keyword
> "async" (asynchronous), which can be used to designate a function's intent
> behavior.
>
There are already two very well thought papers about asynchronous flow:
N4134 and N4244.
I favour N4244 as of now :D
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_384_521773334.1415938822706
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>On Friday, November 14, 2014 9:48:08 AM UTC+7, jmog...=
@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">Hello,<div>I have a proposal for a new c++ language feature. It's=
the keyword "async" (asynchronous), which can be used to designate a funct=
ion's intent behavior. </div></div></blockquote><div><br></div><div>T=
here are already two very well thought papers about asynchronous flow: N413=
4 and N4244. </div><div><br></div><div>I favour N4244 as of now :D</di=
v></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_384_521773334.1415938822706--
.