I am programming a VB 6.0 application and I am trying to understand the threading options that are available.
Under the project properties I have a number of options:
(1) Apartment Threaded, (2) Single threaded,
There are also check boxes for
a) Unattended execution
b) Retained in Memory
c) Upgrade ActiveX controls
This is compiled as an ActiveX dll and I have chosen the "Apartment Threaded Option"
Does this mean that a separate instance of the ActiveX dll memory will be created for each thread that instantiates the object via a "CreateObject" call? The .dll will be running on one or more multithreaded processes, and each process thread may instantiate one or more of the objects.
Q1) AM I at risk for a collision and threads walking on each other on the Class Module, or am I protected by the apartment threading properties of having separate data for each thread.
Q2) Am I protected in the module sections of the .dll? The reason I ask this, is that the public variables in the module section appear to be persistent between threads. Is there anything like an "EnterCriticalSection" (similar to C++) to protect against reentrancy in the module if this is critical?
Q3) Let's say this COM .dll is created by 4 threads in one process and 3 in another: Do I then have 7 separate instantiations of this object?
q4) Are the module public sections across processes at risk of colliding?
I know this is a complex question, so I am offering 500 points to start. For a great answer, I'll give more!