Browse Source

fix unlocking files in non-cygwin windows, thanks Jerome Robert for the investigation

Samuel Thibault 9 years ago
parent
commit
57b50a2039
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/common/utils.c

+ 2 - 0
src/common/utils.c

@@ -275,6 +275,7 @@ int _starpu_frdunlock(FILE *file)
 #  ifndef _LK_UNLCK
 #  ifndef _LK_UNLCK
 #    define _LK_UNLCK _LK_UNLOCK
 #    define _LK_UNLCK _LK_UNLOCK
 #  endif
 #  endif
+	ret = _lseek(fileno(file), 0, SEEK_SET);
 	ret = _locking(fileno(file), _LK_UNLCK, 10);
 	ret = _locking(fileno(file), _LK_UNLCK, 10);
 #else
 #else
 	struct flock lock =
 	struct flock lock =
@@ -294,6 +295,7 @@ int _starpu_fwrlock(FILE *file)
 {
 {
 	int ret;
 	int ret;
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #if defined(_WIN32) && !defined(__CYGWIN__)
+	ret = _lseek(fileno(file), 0, SEEK_SET);
 	do
 	do
 	{
 	{
 		ret = _locking(fileno(file), _LK_LOCK, 10);
 		ret = _locking(fileno(file), _LK_LOCK, 10);