Ich habe versucht, den Systemaufruf "Schlaf" sowohl in Ubuntu 14.04 als auch in Raspian (Raspberry Pi 2B)
zu verwenden, um die Codeausführung für z. 5 sek. Überraschenderweise wird der gesamte Code vor dem Systemaufruf "sleep" innerhalb von Delay während der Laufzeit überhaupt nicht ausgeführt. Hier ist der einfache Code, der das Problem verursacht:Systemanruf Schlaf funktioniert nicht richtig
using System;
using Gtk;
using Mono.Unix.Native;
public partial class MainWindow: Gtk.Window
{
public MainWindow() : base (Gtk.WindowType.Toplevel)
{
Build();
entry1.Alignment = 0.5f;
// This code is not executed:
double result = Math.Pow (2.0, 2.0);
entry1.Text = result.ToString();
// End of code not executed
// Code executed:
Delay (5);
entry1.Text = "Button-A";
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit();
a.RetVal = true;
}
private Int16 Delay (UInt32 value)
{
Mono.Unix.Native.Syscall.sleep (value);
return 0;
}
}
Muß ich grundlegenden Dinge von Linux falsch verstehen oder bin ich einen Compiler-Fehler konfrontiert? Danke für Hinweise zum Thema!