Changeset 24836
- Timestamp:
- 2011-12-01T12:19:00+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/src/txt2dbl-src/txt2dbl.cpp
r24618 r24836 40 40 #include <cstring> 41 41 #include <fcntl.h> 42 #include <string.h> 43 #include <sys/stat.h> 42 44 43 45 #if defined(GSDL_USE_OBJECTSPACE) … … 62 64 // lock a file on linux 63 65 // [hs, 2 july 2010] 64 int lock ( char *filename ) 66 // - modified to create a locl file local to the collection [jmt12] 67 int lock () 65 68 { 66 ///out << "txt2dbl::lock(" << filename << ") => "; 67 int fd2 = open (filename, O_CREAT|O_RDWR, 00644); 69 string file_path (""); 70 char *collect_dir = getenv ("GSDLCOLLECTDIR"); 71 if (collect_dir != NULL) 72 { 73 file_path += collect_dir; 74 } 75 file_path += "/tmp"; 76 if ( access( file_path.c_str(), 00 ) != 0 ) 77 { 78 mkdir(file_path.c_str(), 00777); 79 } 80 file_path += "/gdb.lock"; 81 ///out << "txt2dbl::lock(" << file_path << ") => "; 82 int fd2 = open (file_path.c_str(), O_CREAT|O_RDWR, 00644); 68 83 close (fd2); 69 int fd = open (file name, O_RDWR);84 int fd = open (file_path.c_str(), O_RDWR); 70 85 flock lock = {F_WRLCK, SEEK_SET, 0, 0, 0}; 71 86 fcntl (fd, F_SETLKW, &lock); … … 216 231 // and lock before the operation 217 232 // [hs, 2 july 2010] 218 int thelock = lock ( "gdb.lock");233 int thelock = lock (); 219 234 #ifdef __WIN32__ 220 235 dbf = gdbm_open (dbname, block_size, read_write, 00664, NULL, 1);
Note:
See TracChangeset
for help on using the changeset viewer.