How about swapping the value of `local` and `g` atomically? There'd be no need 
to change the refcounts because they just exchange the ownership at the same 
time. The destruction can be deferred.

Reply via email to