[ODE] RE: ALLOCA

Jon Watte hplus-ode at mindcontrol.org
Mon Mar 1 09:39:51 MST 2004


> Oh dear :-/  I did exactly this, and without any problems!  But perhaps
> I'm missing something...  What do I have to keep in mind?


Many STL implementations use a "marker object" per container class for things like "end". I've seen STL implementations (including those you buy for real money, as a systems vendor) assign "temporarily" to this "end" object. That, of course, breaks horribly in a threaded environment, but only very infrequently.

Same thing with allocator<>-s, they may not be thread safe, even per-instance.

You _can_ implement all the containers and allocators such that, as long as you synchronize access to individual containers per instance, then all the support structure (internal implementation details) is also thread safe, but there are size and performance penalties involved, so most implementations don't necessarily do this.

Putting locking into the actual implementation would be the Wrong Thing (tm) IMO.

Cheers,

				/ h+




More information about the ODE mailing list