single or multiple threaded AND syncronisation
Posted on 2003-11-13
Ok, so I was under the impression that vb is single threaded correct?
well the scenario is thus...
We have a VB application, say "Reciever",
We have many instances of another VB application, say "Client"
We also have a VB COM+ "Event Server" application.
So the client calls a method on the Event Server which fires an event on the Reciever.
This event is handled and carries out some manipulation on the apps members.
In the mean time the app is carrying out its main line of execution.
While stepping through the main code, if an event is fired then the current line will jump to the event code.
So this would say to me that Reciever is multi threaded...
Anyway, when there are multiple Clients running, we get an automation error (-2147164155 OR 8004e005).
So we tried utilising Critical Sections to lock access to the array while in use.
When the main code is executing, we get a lock on the Critical Section and release it at the end of this iteration of the code.
When an event comes in, it attemps to get a lock and in theory has to wait until the lock is released by the main code.
In practice though the lock is granted which means it is implied that the event is in the same thread.
Chicken and egg has nothing on this!
how can we ensure cross-'Thread' sync'ing?
is vb truly single threaded?