summaryrefslogtreecommitdiff
path: root/gee/lazy.vala
diff options
context:
space:
mode:
Diffstat (limited to 'gee/lazy.vala')
-rw-r--r--gee/lazy.vala16
1 files changed, 10 insertions, 6 deletions
diff --git a/gee/lazy.vala b/gee/lazy.vala
index 5e7bc36..4e09e8b 100644
--- a/gee/lazy.vala
+++ b/gee/lazy.vala
@@ -93,7 +93,9 @@ public class Gee.Lazy<G> {
_mutex.lock ();
if (_lazy._func != null) {
if (_state == State.EVAL) {
- _eval.wait (_mutex);
+ while (_state == State.EVAL) {
+ _eval.wait (_mutex);
+ }
_mutex.unlock ();
} else {
do_eval ();
@@ -108,12 +110,14 @@ public class Gee.Lazy<G> {
_mutex.lock ();
if (_lazy._func != null) {
if (_state == State.EVAL) {
- bool res = _eval.wait_until (_mutex, end_time);
- _mutex.unlock ();
- if (!res) {
- value = null;
- return false;
+ while (_state == State.EVAL) {
+ if (!_eval.wait_until (_mutex, end_time)) {
+ value = null;
+ _mutex.unlock ();
+ return false;
+ }
}
+ _mutex.unlock ();
} else {
do_eval ();
}