OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Brian Muth (bmuthSTRAIGHTTHROUGH.COM)
Date: Wed Apr 10 2002 - 09:27:32 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    inline
     
    > HI Brian
    >
    > Thanks for replying and Sorry for the delay in the follow up.
    >
    > Each instance of the poolable component B creates an instance of the
    third
    > party apartment threaded dll C, so i'm not getting what you mean whey
    you
    > say that all the poolable components are using the same instance of C.
    > Again, my understanding of threading models is a bit flaky so i might
    be
    > missing something obvious.
    >
    [Brian Muth] That's not what I meant. Each B has its own instance of C,
    but C is apartment-threaded. There is one thread to server all C
    instances. Ergo if two or more instances of B call their C instance,
    each instance of B has to wait until C's thread becomes available.
     
    > Another question again regarding the protection of the global
    variables.
    > Here again, each instance of B that is created in turn creates an
    instance
    > of C and keeps it as part of an instance specific variable. So in this
    > case also, do I need to use a critical section when i instantiate that
    > instance specific state in the ObjectControl_Activate method ??
    >
    [Brian Muth] My answer is the same. Every time you access your global
    variables (in this case the interface pointer to C) you must protect it
    with some form of synchronization.

    > Another question here, how do i have a global instance of a variable
    in
    > ATL in the COM+ environment or without it ?
    >
    [Brian Muth] Standard C++ global variable will do.

    > Thanks again
    > Rahul
    >
    > -----Original Message-----
    > From: Brian Muth [mailto:bmuthSTRAIGHTTHROUGH.COM]
    > Sent: Thursday, April 04, 2002 10:48 PM
    > To: DCOMDISCUSS.MICROSOFT.COM
    > Subject: Re: Problem in threading model dep in COM+
    >
    >
    > Inline
    >
    > >
    > > We have three layers of calls for a component.
    > >
    > > We have one poolable component(say B) which is neutral threaded and
    is
    > > marked for pooling in COM+. The ObjectControl_Activate of this
    > poolable
    > > component instantiates a third party apartment threaded dll(say C)
    and
    > > keeps the instance alive as one of its member variables till the
    > > application that contains the poolable component in COM+ is shut
    down.
    > > This third party dll basically connects through TCP/IP calls using
    > Winsock
    > > to the third party site to download information (this is not a dll
    to
    > wrap
    > > around a web-service, it uses Winsock). You can say that this
    poolable
    > > component mimics a connection pool. The third party dll, C, is not
    > placed
    > > in COM+.
    > [Brian Muth] So basically all the pooled B components share the same
    > apartment threaded object C. Unless the B components are doing a lot
    of
    > work outside of C, I fail to see how this can scale effectively.
    > Essentially all the B components have to take turns using C.
    >
    > > This poolable component is called by other apartment threaded
    > components
    > > which utilize connections from the connection pool.
    > >
    > > I would like to know whether there are any gotchas involved in
    having
    > this
    > > kind of setup.
    > [Brian Muth] I don't think there are any problems with this design,
    > other than the fact that you are not really pooling the C objects.
    >
    > > As in, are there any issues in instantiating an apartment threaded
    > object
    > > from a neutral threaded component which is pooled in COM ?
    > > Are there any problems in accessing this apartment threaded object
    > whose
    > > instance is kept alive in the neutral threaded component from
    another
    > > apartment threaded application ?
    > [Brian Muth] The proxy-stub should to the right thing for you.
    >
    > > Should i use a critical section in the ObjectControl_Activate part
    of
    > the
    > > neutral threaded component B, when I instantiate the third party dll
    ?
    > [Brian Muth] Any global variables (ie. the interface to the C object)
    > needs to be protected through some kind of synchronization.
    >
    > > Should I use a critical section when I use the third party dll from
    > any
    > > method in the neutral threaded component ?
    > >
    > [Brian Muth] No.
    >
    > > I'm not sure about the threading models in COM and was hoping
    someone
    > > could help me out.
    > >
    > > I'm not sure if this question can be posted in this mailing list. If
    > it
    > > cannot then i'd be grateful if someone could re-direct me to the
    > > appropriate separate mailing list.
    > >
    > [Brian Muth] You are in the right place.
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM