Commit 0410a0e7 authored by Dominik Charousset's avatar Dominik Charousset

Use caf_main in hello_world example

parent 00266207
...@@ -33,13 +33,13 @@ void hello_world(event_based_actor* self, const actor& buddy) { ...@@ -33,13 +33,13 @@ void hello_world(event_based_actor* self, const actor& buddy) {
); );
} }
int main() { void caf_main(actor_system& system) {
// our CAF environment
actor_system_config cfg;
actor_system system{cfg};
// create a new actor that calls 'mirror()' // create a new actor that calls 'mirror()'
auto mirror_actor = system.spawn(mirror); auto mirror_actor = system.spawn(mirror);
// create another actor that calls 'hello_world(mirror_actor)'; // create another actor that calls 'hello_world(mirror_actor)';
system.spawn(hello_world, mirror_actor); system.spawn(hello_world, mirror_actor);
// system will wait until both actors are destroyed before leaving main // system will wait until both actors are destroyed before leaving main
} }
// creates a main function for us that calls our caf_main
CAF_MAIN()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment