fix locks

This commit is contained in:
Vítor Santos Costa
2015-06-19 10:10:02 +01:00
parent 1c06bfdc05
commit f5b50a4179
10 changed files with 62 additions and 49 deletions

View File

@@ -347,13 +347,15 @@ file_size(USES_REGS1)
// there
struct stat file_stat;
if (fstat(fileno(GLOBAL_Stream[sno].file), &file_stat) < 0) {
UNLOCK(GLOBAL_Stream[sno].streamlock);
PlIOError( PERMISSION_ERROR_INPUT_STREAM, ARG1, "%s in file_size/2", strerror(errno));
return false;
}
// and back again
UNLOCK(GLOBAL_Stream[sno].streamlock);
return Yap_unify_constant( ARG2, MkIntegerTerm( file_stat.st_size) );
}
UNLOCK(GLOBAL_Stream[sno].streamlock);
return false;
}