Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2002 16:10:28 -0500
From:      Jordan DeLong <fracture@allusion.net>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        freebsd-chat@FreeBSD.ORG
Subject:   Re: Linker sets portability
Message-ID:  <20020717211028.GA49636@allusion.net>
In-Reply-To: <3D3507A1.A166072D@mindspring.com>
References:  <20020717014008.Y99892-100000@valu.uninet.ee> <3D34AC52.2D882455@mindspring.com> <20020717005629.GA42607@allusion.net> <3D34DD99.11FF8526@mindspring.com> <20020717042724.GA45349@allusion.net> <3D3507A1.A166072D@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

[ Took the OP out of the CC list because he probably doesn't
care ;P ]

On Tue, Jul 16, 2002 at 10:58:57PM -0700, Terry Lambert wrote:
> Jordan DeLong wrote:
[ ... ]
> > This of course *could* lead to A coming back from a modal message
> > loop with a bunch of stuff completely changed.  In legacy code that
> > isn't written with this in mind (or with reentrency in mind in
> > general) problems could result (and legacy code is one the major
> > uses of the STA (ms also suggests using it for threads which display
> > UI).
>=20
> I'd argue that with legacy code, this wouldn't be an issue, and
> B wouldn't be talking to a proxy object because legacy code would
> not be doing that.  8-).

Ahh this is a good point;  of course, the STA is supposed to be
used in new code from threads which display UI anyway according
to MS.

[ ... ]
> > The win32 mutex objects all explicitly support recursion.
> > CRITICAL_SECTION objects have a recursion count for exactly this,
> > etc.
[ ... ]
> You're really mixing programming models here; you need to decide
> if you are protecting code, or protecting data -- *one* or the
> *other* -- and then stick with it, instead of bouncing off the
> walls.

Ahh, this is quite possible.  I'll have to look into strategies
for not recursing on mutexes and such (all the MT coding i've
done in the past has (possibly incorrectly) assumed this was
O.K. practice).

> > Certainly, regardless of whether or not recursing on mutexes is
> > kosher, the creation of a new thread for each method call across
> > the appartments is quite lame.
>=20
> It's not really necessary, either.  In the sample code that comes
> with their SDK, e.g. the POP3 server, Microsoft creates a pool of
> threads, rather than creating and destoring one per call.  I
> really don't know who programs like you are suggesting.

The MS rpc stuff.  They could be pooling but not showing the nonactive
threads in the debugger of course... Dunno.

> > The free threaded marshaller is just an implementation of IMarshal
> > which doesn't.  The only reason it exists is because marshalling is
> > slow and stupid for in proc stuff.  The ftm is also relatively rarely
> > used, because in order for an object to safely use it, all interface
> > pointers it internally holds have to also use the ftm implementation
> > of IMarshall.
>=20
> Or you don't connect things with pointers all over the place;
> the point of OO programming is to limit the object relationships
> to those which are necessary to solve the problem... and no more.
> 8-).

This is probably valid; but the above *is* the reason why so few
components use the freethreaded implementation for marshalling.

> > COM+ is just Yet Another Renaming of COM by MS.  It's the same thing
> > as COM; DCOM is a subset of the overal label.
>=20
> D =3D Distributed.  "Subset" is a matter of definition.  COM has
> a subset of the functionality of DCOM, in that DCOM can do
> everything COM does *plus* do it remotely.  DCOM is only a
> subset if you look at it from an interface persepctive: it
> implements the COM API, but it's not the sum total of code
> that implements the COM API; but that's "implements" as in
> "an implementation class", not as in "a part of the whole".

Erm.  COM =3D=3D In proc, Out of Proc (but on the same machine), and
Across the network (D) com in the usual parlance...  Nowadays COM+
is the rename of it.  DCOM is a subcategory of the overall thing.

> > Furthermore, in reality it is quite rare to use com without knowing
> > if something is in a different adress space, or even a different
> > threading model.
>=20
> This is practice; it wasn't intended by design.  One problem is

This is mostly because it was poorly designed.

[ ... ]
> > > using a simple to write wrapper around the Thunk entry points.
> > > Rental model threading permits the use of local globals, so
> > > long as they aren't used simultaneously (in the FreeBSD world,
> >=20
> > Rental model threading was never implemented by MS.  In win2k they
> > released a new "neutral appartment", which is similar to the old
> > RTA idea, but differs in some significant ways.
>=20
> Such as?

More than one thread can enter it at a time.  The similarity to the
old RTA idea is that the NTA doesn't own its own threads, it only
owns components.

> > > this would be like implementing the interface "x_r()" via a
> > > set of locking primitives and a call to "x()").  Again, it
> > > permits a certain level of backward compatability, and, if the
> > > code is written correcly, it can attempt to set freethreding,
> > > fail to do so, and continue to run (in a degraded peroformance
> > > mode) successfully.
> >=20
> > I don't follow this about freethreading.
>=20
> You can't force a non-freethreadable module to operate in a mode
> where freethreading is required.  It will refuse.  It's an attribute
> you set on the COM object.

Free threading is about marshalling; it's not something that's
"attempted" like you seem to think.  When you have a proxied interface
to an object it *will* do marshalling:  It QI's the object for
IMarshal and gets back an aggregated object which does the work.
This object can be the ftm to circumvent marshalling (it implements
the marshaling stuff by not marshalling), or it can be NULL to tell
the proxy to use standard marshalling.

So I still don't follow your eariler comments...  Maybe you are
talking about something else?

--=20
Jordan DeLong
fracture@allusion.net


--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9Nd1DDrrilS51AZ8RAmXUAJ0QCPxVnA9jDwD+YdLh1YAtgQ/GKACgx/1x
s8LjP7Yva5FekpGlMxPHEv0=
=6qfz
-----END PGP SIGNATURE-----

--6TrnltStXW4iwmi0--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020717211028.GA49636>