Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Critical Section in VFP
Message
De
07/07/2000 12:35:49
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00387913
Message ID:
00389569
Vues:
18
>If you're using multiple WWWC instances and they're all creating DLL multi-use server instances then a CS won't help either because it's cross process and a CS only works interprocess. If this is your game then you need to use mutexes, but again this is all overkill. In the time it takes to make the COM calls and handle the Csections/mutex or whatever you could have closed and re-opened that table.

You may be right. Ultimately the best solution might be to just close the table and re-open it.

I think one of the reason that we wanted to use a multi-use exe was to prevent multiple instances of the com server. The critical section would allow us to have one multi-use exe and force the function calls to queue up.

>If you really have this issue at a critical piece in your code consider sticking that piece of data into a SQL server of some sort - concurrency issues can easily be handled properly there.

Unfortunately in this app, because of the need for speed, SQL is not an option. We have had to do quite few x-based solutions for performance reasons.

By the way. You had said that critical sections were fairly simple to setup with a few API calls. I've tried and posted the code in another thread. I don't seem to be having any luck. Could you take a look at the code? :)



>I didn't read the whole thread. But basically, if you're using a multi-use server you also don't need CS because those by their very nature are queued. You can't make simultaneous calls into a multi-use EXE server.

I ran a test with the DataSessionServer multi-use com server. I had two separate processes which had the following code:
#DEFINE	kcEol		CHR(13) + CHR(10)
.
.
FUNCTION ProcessOne
* DCC - Log start time.
=STRTOFILE( TTOC( DATETIME() ) + kcEol, "D:\ProcessLog.txt", .T. )

* DCC - Loop for 30 seconds.
ltNow = DATETIME()
DO WHILE ltNow + 30 > DATETIME()
ENDDO

* DCC - Log end time.
=STRTOFILE( TTOC( DATETIME() ) + kcEol, "D:\ProcessLog.txt", .T. )

ENDFUNC
I added a link that would call this function on one of the web pages that was part of this app. I brought up the web page on two different machines and then pressed the link on one machine and then 10 seconds later pressed the same link on the other machine.

Following was the result in the ProcessLog.txt:
07/06/00 11:23:08 AM
07/06/00 11:23:18 AM
07/06/00 11:23:48 AM
07/06/00 11:23:48 AM

Both processes finished simultaneously. Now if, as you were saying they queued up, then the above should not have happened.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform