On Wed, Mar 02, 2005 at 04:08:38AM +0000, [EMAIL PROTECTED] wrote:
> Hmm, locking a 'refcount--' doesn't make much sense to me: if two threads
> both do this at the same time, they'll still then both try to free the
> structure. But I see that op_free() does essentially the same thing,
> which confuses me. Can anyone explain how that makes sense?

I haven't been following this thread closely (I don't even know what a
trie is), but I'll chip in anyway.

In the op_free() case, an op tree may be shared by CVs from differnt threads.
The head of the tree contains an OP refcnt, so OP_REFCNT_LOCK is used to
lock it before decrementing it.

On the other hand, using OP_REFCNT_LOCK to lock an SV doesn't seem to make
much sense (but as I said, I havn't been paying close attention).

Dave.

-- 
There's a traditional definition of a shyster: a lawyer who, when the law
is against him, pounds on the facts; when the facts are against him,
pounds on the law; and when both the facts and the law are against him,
pounds on the table.
    -- Eben Moglen referring to SCO

Reply via email to