On Tue, Jul 03, 2001 at 07:55:50AM -0700, Justin Erenkrantz wrote:
> Wouldn't it be better to try and determine which platforms/lock types
> we don't need the APR_PROCESS_PRIVATE lock on when they attempt to
> acquire APR_PROCESS_SHARED? Is there some way to detect that?
That is what CROSS_PROCESS was for, but I argue that it is inappropriate
under other conditions (like threaded APR and threaded app).
> And, I believe we were saying that at least when you have threads,
> that the current behavior of CROSS_PROCESS is unacceptable (as it
> leaves the behavior on your process undefined which is completely
> bogus). So, for threaded APR, this is MUCH better, IMHO.
>
> For PROCESS_SHARED, I guess a compromise would be to do:
>
> create sharable mutex
> #if APR_HAS_THREADS
> if (sharable-mutex-type->flags & APR_SHARED_LOCK_DOES_NOT_LOCK_PRIVATE)
> create per-process mutex
> #endif
That would be useful if APR_HAS_THREADS was somehow set per the app's
definition, not at APR's buildtime. I assume you're talking about this:
case APR_PROCESS_SHARED:
if (new->inter_meth->flags & APR_PROCESS_LOCK_MECH_IS_GLOBAL) {
new->meth = new->inter_meth; /* impl. uses one lock */
}
else {
new->meth = &lockall_methods; /* impl. uses two locks */
}
break;
> I dunno. We know if we don't have threads that the PRIVATE mutex is not
> important. And, if our SHARED mutex also has the force of PRIVATE, then
> we don't even need to create the extra PRIVATE mutex. Or, maybe just
> always create the PRIVATE mutex if APR_HAS_THREADS is 1 (if we don't
> know if SHARED implies PRIVATE - which is our problem to begin with).
>
> This could give the non-threaded users of APR even more reason to
> specify "--without-threads" when configuring - which they should be
> doing in the first place.
yes. And we want recompiles of APR, no?
> (Man, I can't stand those god-awful CROSS_PROCESS names.) -- justin
(That's why I went for PROCESS_SHARED vs PROCESS_PRIVATE. "cross", "intra",
"inter", "blah" was used back and forth and was very confusing, especially
when "cross" isn't always truely "cross" since it's really just within
your process group, yadda yadda... :)
-aaron