Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Critical Section in VFP
Message
De
10/07/2000 13:31:35
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00387913
Message ID:
00390362
Vues:
14
Ok. Ok. I give. I tested this both with two instances of FoxPro then the web test with the same result. The first thread was suspended, then when the second thread finished, the first thread resumed and finished. Thank you for the code. That made it very clear.

Here's the scenario we want to avoid. First process comes in finds the record it wants. Right before it retrieves the data, the second process suspends the first, and moves the record point to the new record. The second process returns the correct data. Now the first process is on the wrong record and returns the incorrect data.

>Hi Dan,
>
>Try this. Compile the following program into a COM MultiUse Server EXE with a project named DanC:
>
>Define Class DanC as Custom OlePublic
>   Procedure Process(tcID,toOutput,tnTime)
>      toOutPut.Cls()
>      Local lnStart, lnStart2
>      lnStart = Seconds()
>      Do While lnStart+tnTime > Seconds()
>         lnStart2 = Seconds()
>         Do While lnStart2+1 > Seconds()
>         Enddo
>         toOutPut.Print( m.tcID+Str(Seconds(),10,3)+Chr(13) )
>      Enddo
>       toOutPut.Print( "E>"+m.tcID+Str(Seconds(),10,3) )
>   EndProc
>Enddefine
>Now open two instances of VFP and in the first run the following code:
>
>ox = CreateObject("DanC.DanC")
>ox.Process("1",_SCREEN,30)
>
>wait until the COM server prints the first line and then issue the following code in a second instance of VFP:
>
>ox = CreateObject("DanC.DanC")
>ox.Process("2",_SCREEN,10)
>
>You can see that the COM server prints the results in the first instance, then switches over to the second instances for 10 seconds, and finally continues in the first instance. In fact, if you check the value of PROGRAM(-1) you can see that the second instance is treated as a subprogram. The DO level is 1 for the first instance and 2 for the second instance.
>
>Makes me wonder if you can use RETURN TO MASTER to cancel all processes. *g*
>
>Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform