Herunterladen Inhalt Inhalt Diese Seite drucken

Conrad C-Control II Unit Handbuch Seite 81

Kompakter steuerungscomputer
Inhaltsverzeichnis

Werbung

5 Programmiersprache C2
float a, b;
byte flag;
thread measure
{
capture flag;
a = get_channel_a();
b = get_channel_b();
release;
//...
}
thread watch
{
capture flag;
check(a, b);
release;
// ...
}
2.) Synchronisation von Ressourcenzugriffen durch implizites capture in einer Funktion
function send ( byte buf[], int length )
{
capture;
wait ressource.ready();
ressource.send(buf, length);
release;
}
Im Beispiel wird hier ein Modul ressource angenommen, dessen Funktionen selbst
noch nicht synchronisiert sind. Alle Bibliotheksmodule zum Zugriff auf Systemressourcen der
C-Control II Unit enthalten bereits die notwendige Synchronisation (siehe z.B. Modul
hwcom.c2).
// Messwerte
// Synchronisationsvariable
81

Quicklinks ausblenden:

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis