- while (1) {
- char* received = static_cast<char*>(mbox->get());
- XBT_INFO("I got a '%s'.", received);
- if (std::strcmp(received, "finalize") == 0) { /* If it's a finalize message, we're done */
- xbt_free(received);
- break;
- }
- /* Otherwise receiving the message was all we were supposed to do */
- xbt_free(received);
+ for (bool done = false; not done;) {
+ std::string* received = static_cast<std::string*>(mbox->get());
+ XBT_INFO("I got a '%s'.", received->c_str());
+ done = (*received == "finalize"); // If it's a finalize message, we're done
+ // Receiving the message was all we were supposed to do
+ delete received;