Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lock and unlock process in VFP?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00601553
Message ID:
00601785
Vues:
24
You can use a semaphore locking using tables.
Ex:
semaphore.dbf
Process C(10)
timestamp T

Ex code:
Insert into semaphore (Process,TimeStamp) value ( "Process1",datetime())
Insert into semaphore (Process,TimeStamp) value ( "Process2",datetime())

DoProcess("Process1","Process2")
DoProcess("Process2","Process1")

function DoProcess
parameter tcToDo,tcWhenFinis
local lDone
ldone = .f.

select Semaphore
locate for process = tcWhenFinis
if found() and rlock()
   Unlock
   locate for process = tcToDO
   if found() and rlock()
      &tcTodo
      select Semaphore
      unlock
      lDone = .t.
   endif
endif
return lDone
Anyway you get the idea.


>Hi,
> Can be blocked a program waiting for another one wakes up it? I'm talking about something similar to the barriers .(It is obvius that loops waiting for variable changes is an horrible idea).
>
> My process must wait for the results of another independent process.
>
> I would like a solution with events or locking calls.
>
> Is it possible to make a call from process 1 to 2 that it blocks to first and the second unblocks it at any time (not necessarily by the conclusion of 2)?
>
>Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform