+ if(file->depends_on) {
+ SrcFile *dep = file->depends_on;
+ // check first without lock
+ if(dep->status == 0) {
+ if(dep->lock) {
+ pthread_mutex_lock(&dep->lock->mutex);
+ if(file->depends_on->status == 0) {
+ pthread_cond_wait(&dep->lock->cond, &dep->lock->mutex);
+ }
+ pthread_mutex_unlock(&dep->lock->mutex);
+ } else {
+ // locking disabled (because we have only one thread)
+ // but in that case the file status can't be 0
+ // therefore this case here should not happen
+ file->status = -1;
+ }
+ }
+ // check again
+ if(dep->status == -1) {
+ file->status = -1;
+ }
+ }
+