Search found 80 matches: flock

Return to advanced search

Re: use FLOCK()

And as long as that computer is frozen, any semaphone lock files would remain. Yes, and... If computer is frozen, application is frozen, all in application is frozen, dbfs frozen, conexion frozen, gdis recurses frozen, application handles files are frozen and of course semaphore files is frozen... ...
by hmpaquito
Fri Jan 30, 2015 6:10 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

Hmpaquito, Application is hang... All in application is hang... so it's very normally handles files too hang... where is a problem ? I'm not sure I understand what you are saying. Did you mean that if the application hangs it will always hang on all users computers at the same time? If so, I don't t...
by James Bott
Fri Jan 30, 2015 5:32 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

I was referring to a hang, not a crash. When the computer hangs the file is still locked. It will only be unlocked when the computer is rebooted or turned off. I'm not sure there is anyway to handle a hang. Application is hang... All in application is hang... so it's very normally handles files too...
by hmpaquito
Fri Jan 30, 2015 5:20 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

I was referring to a hang, not a crash. When the computer hangs the file is still locked. It will only be unlocked when the computer is rebooted or turned off. I'm not sure there is anyway to handle a hang.
by James Bott
Fri Jan 30, 2015 5:15 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

... the semaphore locked? James Operating System does work for us. Since MSDOS times, when application crash, OS close open files. // Use sample:aId:= FLockOn()REPLACE ALL CodePro WITH "XXX"FLockOff(aId)// Core functionsFUNCTION FLockOn()local cId:= "FLock_"+ ...
by hmpaquito
Fri Jan 30, 2015 4:20 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

One issue with adding locking tracking to any existing program is that you are going to have to add code before and after every file lock in the program. That is, unless, you are using a database class. In this case all you have to do is create a subclass and add locking tracking. Then it gets used ...
by James Bott
Fri Jan 30, 2015 3:51 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

Hmpaquito,

OK, I see, the code you are showing is just a basic concept. I thought it was a completed system and I could not see anyway to track flocks().

I am curious as to how you handle a computer that hangs when a semaphore is locked. Doesn't this leave the semaphore locked?

James
by James Bott
Fri Jan 30, 2015 3:40 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

hmpaquito , Your code, like that posted by Herbert, only can only determine who opened the file in exclusive mode. If the file is opened in shared mode, anyone can lock it later. James, No. My code blocks all. Or what you want to mark as used. It all depends on how the user uses it. So maybe the fu...
by hmpaquito
Fri Jan 30, 2015 8:30 am
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

... exclusive mode. If the file is opened in shared mode, anyone can lock it later. There needs to be a function that records who locks the file using flock(). Something like this: Function MyFlock( cAlias, cUser )    local lReply:=.f.    if (cAlias)->(flock())    ...
by James Bott
Thu Jan 29, 2015 11:58 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

Herbert,

Looks like lots of good code. Unfortunately, I don't think it answers his question. He wants to know who has the file locked--it could have been opened by someone else. It seems, the functions you provided only can determine who opened the file.
by James Bott
Thu Jan 29, 2015 11:34 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

I Forgot to write you how to use. Sample Code: * Mapped drive, specific file 'Sometable.dbf'WhoHasFileOpen("X:\Somefolder\SumSubfolder\Sometable.dbf") * Mapped drive, all extensions for specific file name 'Sometable'WhoHasFileOpen("X:\Somefolder\SomeSubfolder\Sometable&quo...
by hebert_j_vargas
Thu Jan 29, 2015 5:58 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

Hi, i was Interested in this subject, searching on google I found this app used on Visual Fox Pro (VFP), maybe you can use this: WinApiSupport.prg DEFINE CLASS WinApiSupport AS Custom    * Converts VFP number to the Long integer    FUNCTION Num2Long(tnNum)        LOCAL lcStringl        lcStr...
by hebert_j_vargas
Thu Jan 29, 2015 5:56 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

...   ELSE        lOn:= .f.    ENDIFENDIF....RETURN lOn Sample: IF IsSemaphoreOn("Filebase_FLock")   msginfo("Filebase yet flock !")   returnENDIFnHandle:= SemaPhoreOn("Filebase_FLock")USE FileBaseflock()...SemaphoreOff(nHandle) ...
by hmpaquito
Thu Jan 29, 2015 5:03 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

Stefano, Did you mean a file lock, or perhaps a record lock? There was a discussion of how to determine locking via programming many years ago. I can't find it in my notes, but as I remember it the way was to record the file and user in a DBF when locking and remove the record when unlocking. The pr...
by James Bott
Thu Jan 29, 2015 3:24 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097

Re: use FLOCK()

This is possible only in ADS client-server version.
by nageswaragunupudi
Thu Jan 29, 2015 12:28 pm
 
Forum: FiveWin for Harbour/xHarbour
Topic: use FLOCK()
Replies: 24
Views: 6097
PreviousNext

Return to advanced search