Am Sonntag, 8. Oktober 2006 03:52 schrieb Bob Rogers:
> Sounds good to me.  But in that case, outer_ctx is not much better
> . . . but that's probably a much bigger job.
>
>    In any case, I discovered that Lua fails ~300 test cases with this
> patch.  So, if we still consider it worth dropping this feature, it
> might be better to give it a period of deprecation before we break it
> permanently.  How does this sound?

Hmm. Let's trying to keep autoclose then maybe. Given that I'm trying to 
propose a different strategy:

We have some structures (or PMCs) which ought to be sharable across threads. 
These are mainly PBC-related things, like PF structures and Subs. OTOH some 
of these have interpreter (aka thread) specific stuff in them, as the 
mentioned ctx's.

Instead of storing the thread-specific item directly, we store a key for that 
item. The key is the same for all threads. The data associated with the key 
are stored in the interpreter.

This sounds exactly like pthread_{g,s}etspecific (3p) and related, and indeed, 
when pthread is available we just could use it. OTOH we could provide a more 
general solution usable for all platforms.

We have a per-interpreter ResizablePMCArray (1) with the items. During 
initialization we simulate pthread_once(3p) to acquire the next key, which is 
the next avaiable slot in that Array (starting from 1).

(1) As stored items are currently a mixture of PMCs and other pointers, this 
array would not be marked during DOD. If there's some PMC stored into it, 
which isn't anchored elsewhere, it would need marking through 
dod_egister_pmc(). The array would be more a RVA (*Voidp*).

leo

Reply via email to