From: Arnaud Giersch Date: Tue, 21 Dec 2010 16:26:44 +0000 (+0100) Subject: Deadlock fix, and other changes. X-Git-Tag: v0.1~213 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/0c4a3402a57c61218bf1d1c6d8c31f5c3e1482f9?hp=0c4a3402a57c61218bf1d1c6d8c31f5c3e1482f9 Deadlock fix, and other changes. Fix a deadlock occuring when there was no load anymore in the system. Each remaining process had nothing to compute, nor to send to their neighbors, and were blocked waiting for an incoming message. The fix consists in: * adding a shared global variable total_load_running, the sum of loads currently in the system ; and * ensuring this variable is always up-to-date ; and * making processes terminate if total_load_running is null. The use of a global variable is not satisfactory, but it is good enough for now. It is also verified, at the end of the simulation, that total_load_running is null. Other important changes in this commit are: * process::receive() now consumes all pending messages (it used to consume only one). * The iteration number is only incremented when there is something to compute (load > 0.0). Note: bookkeeping version may be broken. ---