]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
test: Add property lock test
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 16 Sep 2018 17:27:17 +0000 (19:27 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 17 Sep 2018 06:04:46 +0000 (08:04 +0200)
tests/objects/properties.vala

index 3d86de106fb4a44ae31754869020b365d38c899a..8008c1acbc3ff715e7d27b0fc604725a340a8fb3 100644 (file)
@@ -28,6 +28,9 @@ public class Sample : Object {
                get { return _read_only; }
        }
 
+       public int public_prop { get; set; }
+       private int private_prop { get; set; }
+
        public Sample (string name) {
                this.name = name;
        }
@@ -56,7 +59,14 @@ public class Sample : Object {
                stdout.printf("automatic: %s\n", automatic);
 
                this.deleg = null;
-        }
+
+               lock (public_prop) {
+                       public_prop = 42;
+               }
+               lock (private_prop) {
+                       private_prop = 42;
+               }
+       }
 
        public static int main () {
                var test = new Sample("InitialName");