cloud-software-foundation / c5

c5
Apache License 2.0
12 stars 8 forks source link

Annotation that a field is only accessed from a particular Fiber #298

Open joshua-g opened 10 years ago

joshua-g commented 10 years ago

I think it would make it easier to change or review someone's code, if you were aware of their intention that a mutable field only be accessed from a particular Fiber. Not only is it a reminder for editors, but it makes it clear that the author considered concurrency issues related to that mutable field, rather than forgetting to do so.

Fiber myFiber;

@FiberOnly(myFiber)
private boolean state;

Is this useful enough to justify the extra verbosity?