diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-15 14:55:13 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-16 12:01:06 -0700 |
commit | d2246b22e00ef1b189b3e2f279f6b1af056ef995 (patch) | |
tree | d30788c615106594e39a669ddb8e6058f326beaf /src/mbgl/actor | |
parent | 41bbd4e4f7d66465433e370ca024ab0239fcace3 (diff) | |
download | qtlocation-mapboxgl-d2246b22e00ef1b189b3e2f279f6b1af056ef995.tar.gz |
[core] Document the ActorRef<O> argument passed to O's constructor
Diffstat (limited to 'src/mbgl/actor')
-rw-r--r-- | src/mbgl/actor/actor.hpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mbgl/actor/actor.hpp b/src/mbgl/actor/actor.hpp index 281bbdaed1..810114c513 100644 --- a/src/mbgl/actor/actor.hpp +++ b/src/mbgl/actor/actor.hpp @@ -22,12 +22,6 @@ namespace mbgl { to R is *not* guaranteed (and can't be: S1 and S2 may be acting asynchronously with respect to each other). - Construction and destruction of an actor is currently synchronous: the corresponding `O` - object is constructed synchronously by the `Actor` constructor, and destructed synchronously - by the `~Actor` destructor, after ensuring that the `O` is not currently receiving an - asynchronous message. (Construction and destruction may change to be asynchronous in the - future.) - An `Actor<O>` can be converted to an `ActorRef<O>`, a non-owning value object representing a (weak) reference to the actor. Messages can be sent via the `Ref` as well. @@ -38,6 +32,13 @@ namespace mbgl { the lifetime of the owning Actor, and sending a message to a `Ref` whose `Actor` has died is a no-op. (In the future, a dead-letters queue or log may be implemented.) + Construction and destruction of an actor is currently synchronous: the corresponding `O` + object is constructed synchronously by the `Actor` constructor, and destructed synchronously + by the `~Actor` destructor, after ensuring that the `O` is not currently receiving an + asynchronous message. (Construction and destruction may change to be asynchronous in the + future.) The constructor of `O` is passed an `ActorRef<O>` referring to itself (which it + can use to self-send messages), followed by the forwarded arguments passed to `Actor<O>`. + Please don't send messages that contain shared pointers or references. That subverts the purpose of the actor model: prohibiting direct concurrent access to shared state. */ |