- int result = 0;
- simgrid::s4u::MutexPtr mutex = simgrid::s4u::Mutex::create();
-
- for (int i = 0; i < NB_ACTOR * 2 ; i++) {
- // To create a worker use the static method simgrid::s4u::Actor.
- if((i % 2) == 0 )
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), workerLockGuard, mutex,
- std::ref(result));
- else
- simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker, mutex, std::ref(result));
+ /* Create the requested amount of actors pairs. Each pair has a specific mutex and cell in `result`. */
+ int result[cfg_actor_count.get()];
+
+ for (int i = 0; i < cfg_actor_count; i++) {
+ result[i] = 0;
+ sg4::MutexPtr mutex = sg4::Mutex::create();
+ sg4::Actor::create("worker", sg4::Host::by_name("Jupiter"), workerLockGuard, mutex, std::ref(result[i]));
+ sg4::Actor::create("worker", sg4::Host::by_name("Tremblay"), worker, mutex, std::ref(result[i]));