Flush suspend before the resume code
authorEnrico Zini <enrico@enricozini.org>
Fri, 2 Oct 2009 15:07:42 +0000 (16:07 +0100)
committerEnrico Zini <enrico@enricozini.org>
Fri, 2 Oct 2009 15:07:42 +0000 (16:07 +0100)
src/app_power.vala

index 5dbc196861505ec9c757bb96b7a9de781a0145c6..11b33c8d69929517d721251ade6c5590eb1e723e 100644 (file)
@@ -104,10 +104,15 @@ public class Power : zavai.Resource, Object
                        // amixer -q -d sset "Amp Spk" mute
                        // sync;sync;sync
                        // echo 0 | sudo tee /proc/sysrq-trigger
-                       FileStream state = FileStream.open("/sys/power/state", "w");
-                       if (state != null)
                        {
-                               state.puts("mem\n");
+                               // Limit the scope of state, so that it's
+                               // closed before we resume
+                               FileStream state = FileStream.open("/sys/power/state", "w");
+                               if (state != null)
+                               {
+                                       state.puts("mem\n");
+                                       state.flush();
+                               }
                        }
                        // amixer -q -d sset "Amp Spk" unmute
                        try {