4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "DrawThread.hpp"
25 #include "MapWindow/GlueMapWindow.hpp"
30 * Main loop of the DrawThread
37 // bounds_dirty maintains the status of whether the map
38 // bounds have changed and there are pending idle calls
39 // to be run in the map.
41 // wait until the startup is finished
42 if (CheckStoppedOrSuspended())
45 // Get data from the DeviceBlackboard
46 map
.ExchangeBlackboard();
48 bool bounds_dirty
= true;
50 // circle until application is closed
55 if (!bounds_dirty
|| trigger
.Wait(MIN_WAIT_TIME
)) {
56 /* got the "stop" trigger? */
57 if (CheckStoppedOrSuspended())
62 if (IsCommandPending()) {
63 /* just in case we got another suspend/stop command after
64 CheckStoppedOrSuspended() returned and before the trigger
65 got reset: restore the trigger and skip this iteration, to
66 fix the race condition */
71 // Get data from the DeviceBlackboard
72 map
.ExchangeBlackboard();
74 // Draw the moving map
78 // interrupt re-calculation of bounds if there was a
79 // request made. Since we will re-enter, we know the remainder
80 // of this code will be called anyway.
84 bounds_dirty
= map
.Idle();
85 } else if (bounds_dirty
) {
86 /* got the "stop" trigger? */
87 if (CheckStoppedOrSuspended())
90 bounds_dirty
= map
.Idle();