Changeset b330c41 in tol


Ignore:
Timestamp:
Jan 13, 2015, 4:33:09 PM (12 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
c07874d
Parents:
8d33e4c4
Message:

New function OSWaitForLockedFile: Checks if a file is locked anf then waits until it is unlocked

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@6432 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/system/_system.tol

    r8d33e4c4 rb330c41  
    547547 
    548548//////////////////////////////////////////////////////////////////////////////
     549Text OSWaitForLockedFile(Text file)
     550//////////////////////////////////////////////////////////////////////////////
     551{
     552  Real handler = FOpen(file,"r+b");
     553  While(!handler,
     554  {
     555    WriteLn("File "+file+" is locked. Waiting ...");
     556    Real Sleep(2);
     557    Real handler := FOpen(file,"r+b")
     558  });
     559  Real If(handler, FClose(handler));
     560  file
     561};
     562PutDescription(
     563"Checks if a file is locked anf then waits until it is unlocked",
     564OSWaitForLockedFile);
     565//////////////////////////////////////////////////////////////////////////////
     566
     567 
     568//////////////////////////////////////////////////////////////////////////////
    549569// Tests
    550570//////////////////////////////////////////////////////////////////////////////
    … …  
    567587};
    568588
     589
    569590/* */
Note: See TracChangeset for help on using the changeset viewer.