21 lines
412 B
Vala
21 lines
412 B
Vala
|
/* Vala Lock Example */
|
||
|
using GLib;
|
||
|
|
||
|
public class Sample : GLib.Object {
|
||
|
|
||
|
private int critical_data;
|
||
|
|
||
|
public void inc () {
|
||
|
|
||
|
lock (critical_data) {
|
||
|
critical_data++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void main (string[] args) {
|
||
|
|
||
|
var sample = new Sample ();
|
||
|
sample.inc ();
|
||
|
}
|
||
|
}
|