Basic MultiThreading Question

Topics: Developer Forum
Sep 9, 2015 at 1:22 AM
Hello - I have a general question about how ActiveVFP processes code. So, let's suppose I'm doing a Select SQL in my avfp file. Next, let's suppose (all hypothetical) that the Select SQL takes 20 seconds if there are no indexes. The question is, can the web server accept other connections while it is bogged down with this query and if so, how does it accomplish this?

Thanks for your input on this.
Sep 11, 2015 at 12:44 AM
Yes. AVFP is multi-threaded, so the server (IIS in this case) would be able to accept new connections while other connections are busy.

Victor Espina
Sep 14, 2015 at 8:41 PM
We use the VFP mtdll (multi-threaded dll). Each web request spins up another thread to VFP. This is MUCH MUCH more efficient than starting a VFP EXE with each request.
Sep 15, 2015 at 7:39 AM
I'm curious - just in general where I can learn more about creating VFP dll files. I see the build in VFP and I always choose exe but I'm just curious in general how one would build a dll from a VFP file and where to learn more about that.

Sep 15, 2015 at 8:16 AM
Never mind - I got it. Really COOL Stuff.

So, is the DLL more efficient because it only needs to be loaded one time in memory? is it much faster and/or more efficient than an exe file?

Also, I was curious as to whether it's loaded at all or perhaps only one time in the task manager if several threads are open at the same time.

Thank you again,
Sep 15, 2015 at 6:02 PM
Edited Sep 15, 2015 at 6:03 PM
Exactly. the run time is loaded just one time and shared making it faster and far less memory intensive.

This old paper by Calvin Hsia really goes into some of the nitty gritty of vfp mtdlls:
Sep 15, 2015 at 6:19 PM
Yes - I also noticed you can easily pass objects to the dll which you can't do with an exe but I can see where Calvin's paper is important since the multi-threading is not directly supported in VFP in which case you would need to run an exe. This looks very interesting. Thanks for the link.