PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

how do you lock a file in pgf90?

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
bystrc



Joined: 28 Jul 2004
Posts: 1

PostPosted: Sat Jul 16, 2005 4:56 am    Post subject: how do you lock a file in pgf90? Reply with quote

Does anyone know how to lock an open file in pgf90, so that other processes cannot open it?
My fortran90 program is a back-end for a Java GUI which checks for the existence of a file, then opens it -- but, often before the file has been closed by the fortran back-end. I want a way to tell the Java front-end to wait until the file is closed.
Ideas?
--Chris @ RPI
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Mon Jul 18, 2005 10:42 am    Post subject: Reply with quote

Hi Chris,

As far as I know there is nothing in Fortran that allows you to directly lock a file. You could probably use the C system 'fcntl' function, but this might be a bit of a headache since you'll need to write a C interface to both Fortran and Java.

Another solution might be to create a temporary file and have your Java program poll for the existence of the temp file. Once your done writing to the data file, also close the temp file using the CLOSE specifier 'STATUS=DELETE' to delete the file. Once the temp file is gone, the front-end knows it can read from the data file.

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group