PDA

Click to See Complete Forum and Search --> : Confused on Threading, Please Help


Lethal
Mar 14th, 2001, 02:38 AM
I'm a little confused on this topic, my book kind of contradicts itself. Ok, let's say I create an ActiveX EXE and set it's instancing property to MultiUse. And also I set its threading to Thread Per Object. My book says that all instances of a MultiUse server run in a single thread, one clients requests for a service from the server will effectively block all other requests for that service until the request is completed. Now, since I changed the threading to thread per object, wont each object run in a seperate thread and avoid "Blocking". Thanks

tumblingdown
Mar 15th, 2001, 09:21 PM
Thread per object means that all COM requests will get seperate "threads" for each object. This includes yourself, if you use CreateObject and not New. (CreateObject passes the call out to COM, which calls CoCreateInstance, New lets VB handle the creation).

Therefore you can create "multithreaded" servers based on this principle. However, be wary. If your server is anything other than lightweight, you will quickly run into time-slicing problems that will prolly cause the very things you are trying to avoid. This is no substitue for real (function based, re-entrant, thread syncing and locking) multithreading , but is usefull for serving up lightweight objects with a good approximation of multithreaded-ness.



td.