At 07:28 PM 9/10/01, you wrote:
>+---------- On Sep 10, Jerry Asher said:
> > Modifying the table becomes lengthy, you need to verify on your platform
> > that you can swap a pointer in an atomic operation, readers can get old
> > values for some period of time, but readers never have to lock the table.
>
>Consider this:
>
> reader is accessing table A, uses whole time slice and gets
> preempted; it has pointers to table A internals in registers/stack
>
> writer copies table A to table B, makes table B active
>
> writer copies table B to table A, makes table A active
>
> reader gets CPU back, is still accessing table A but A's internals
> have been changed, reader gets SIGSEGV
I'm not sure. It's true that the writer shouldn't just free the table -- I
guess that readers need to refcount it (and unrefcount it), and I'm not
sure how that's done or what that does in terms of overhead. But I would
think that if it's a tcl coordinated refcounted table, it wouldn't go away
if the reading routine has inc'd it's ref count, the reader is just reading
from a table that "newer" readers wouldn't be reading from.
There does need to be some algorithm to reclaim storage from refcount 0
tables and to keep track of them. I'm not sure how Tcl does that.
Or I might be all wet.
Jerry
========================================================
Jerry Asher [EMAIL PROTECTED]
1678 Shattuck Avenue Suite 161 Tel: (510) 549-2980
Berkeley, CA 94709 Fax: (877) 311-8688