Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Critical Section in VFP
Message
De
08/07/2000 20:40:57
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00387913
Message ID:
00389902
Vues:
17
>Hi Dan.
>
>>Both processes finished simultaneously. Now if, as you were saying they queued up, then the above should not have happened.
>
>Yep. If you have a Multi-Use Server EXE, the second call interrupts and supends the first call. It waits for 30 seconds, returns, and then the first call is continued. Since you use a time loop here, it finishes immediately. If you use a count loop, or something else that is indpendant of time, you can see that call 1 is terminated after call 2. In a single-threaded COM server only one VFP interpreter can run at a time.
>
>Critical Sections: In a VFP Server those are only necessary when you are running a multi-threaded DLL where indeed multiple instances of the VFP interpreter run at the same time. Otherwise you only need it when you are using a DLL that is called from another multithreaded server and you need to keep that other server from jumping in.
>
>In an EXE server, CSs are useless, because there can only be one VFP thread be running at a time. All others are blocked anyway.
>
>Christof

I changed the function a little bit adding a parameter. The first machine pressed on link that passed a "1" and the seconds machine pressed the 2nd link that passed a "2". In the DO WHILE loop I continued writing to the log with the number passed and the date and time.

If what you say is true. I should see the first machine that hits the server in the log until the second machine hits the server and then we should only see entries from that machine until they both end and we should then see two entries "2" ending and then "1" ending.

But in fact what happens is you do get entries from the first machine and then you get entries from the second machine as soon as that hit occurs but you never here from the first machine again, as follows:
1.
1.
1.
1.
.
.
1.
approx 10 seconds from from 1 in the text I ran.
2.
2.
2.
.
.
2.
2.
We get entries from 2 for 30 seconds.

Then it ends. I believe that in reality whats happening is that both are running relatively simultaneously. I've got a variable that I store which number the hit is coming from. When I change that variable it changes for both. This is why you never see it change back to '1'. I did not test the for loop you suggested, but I am fairly certain that the loop variable will be changed by the second hit which will cause the first machine to restart back at one and then they will both end at approximately the same time.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform