Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Fri, 12 Aug 2005 10:26:46 -0400
..Suchit <Suchit@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> (+) Suppose different threads call Advise(..) on a Global
> Interface Table registered pointer; and the call method with
> different parameters:
>
> **** When the processing is done, the argument 1 data is avaialble.
> When VisualBasic calls RaiseEvent() .. will all the threads get back
> this result Event for argument 1? I mean will EventSinkMethod() be
> called for all sink objects in various threads? ****
Yes, VB broadcasts an event to all attached sinks. If you want a
per-operation callback, event sink is a wrong mechanism. Instead, you
should pass the callback interface as part of the job parameters:
pMyControl->DoSomething(param, pMyCallback);
The control would then perform the operation asynchronously, and call a
method on the callback interface when done.
By the way, is the control's method indeed asynchronous? Because if it's
not (you call it, it performs its action and only then returns from the
call) you don't need any events or callbacks. Just call the method, your
thread will sit there waiting for it to complete, then any output could
be communicated back to you through parameters.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: .Suchit
- Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: Brian Muth
- Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: .Suchit
- Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: Brian Muth
- Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- From: .Suchit
- Why Thread-Safe VB6 ActiveX when it is single threaded?
- Prev by Date: Re: confused: Multi-threading, Apartments, Sinks, Debugging
- Next by Date: Re: Has anyone used Link Source Descriptor or Link Source Clip board t
- Previous by thread: Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- Next by thread: Re: Why Thread-Safe VB6 ActiveX when it is single threaded?
- Index(es):
Relevant Pages
|