[D-runtime] A cooperative suspension API
Alex Rønne Petersen
xtzgzorex at gmail.com
Sat May 5 07:37:15 PDT 2012
I don't follow. Why would inlining the function have any impact on how
many times the variable is actually read? That seems like a totally
separate issue.
Regards,
Alex
On Sat, May 5, 2012 at 3:19 PM, Michel Fortin <michel.fortin at michelf.com> wrote:
> Le 2012-05-05 à 0:45, Alex Rønne Petersen a écrit :
>
>> (note that races in reading the variable are acceptable).
>>
>> private bool m_isCooperative;
>>
>> @property final bool isCooperative()
>> {
>> return m_isCooperative;
>> }
>
> Even if races are acceptable, the code above is buggy. You need to make the read volatile if you don't want the compiler to optimize things by reading the variable only once when the function is inlined. (And I know volatile is deprecated.)
>
>
> --
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
>
>
>
>
>
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
More information about the D-runtime
mailing list