* task safe linked list?
@ 1997-11-21 0:00 Tom Moran
1997-11-23 0:00 ` Geert Bosch
0 siblings, 1 reply; 2+ messages in thread
From: Tom Moran @ 1997-11-21 0:00 UTC (permalink / raw)
Is there a good way to use Protected Types to make a task safe linked
list? I'd like to add/remove things on a dynamice set of lists with a
protected object to ensure serialized access to the links. But where
could the protected object go? Not in any one node because
insert/remove is a three-node operation. Not in any one list root
because these lists are not rooted, but are linked groups, ie, objects
a,b,c are linked together as are d and e and I might add f to a,b,c or
to d,e, or remove b from the former and add it to the latter. It
appears I must use a single global lock on "any fiddling with any
links in any list'. Any other suggestions?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: task safe linked list?
1997-11-21 0:00 task safe linked list? Tom Moran
@ 1997-11-23 0:00 ` Geert Bosch
0 siblings, 0 replies; 2+ messages in thread
From: Geert Bosch @ 1997-11-23 0:00 UTC (permalink / raw)
Tom Moran <tmoran@bix.com> wrote:
Is there a good way to use Protected Types to make a task safe linked
list? I'd like to add/remove things on a dynamice set of lists with a
protected object to ensure serialized access to the links. But where
could the protected object go? Not in any one node because
insert/remove is a three-node operation. Not in any one list root
because these lists are not rooted, but are linked groups, ie, objects
a,b,c are linked together as are d and e and I might add f to a,b,c or
to d,e, or remove b from the former and add it to the latter. It
appears I must use a single global lock on "any fiddling with any
links in any list'. Any other suggestions?
I would use a List_Manager protected type with all necessary tree operations.
Then you just call Some_Manager.Insert (New_Node, List) for example.
It is a good idea to make the Node_Type a limited private type and
put it in a generic package with the List_Manager, so you can be
sure the list is only accessed through the List_Manager.
Then you can use multiple instantiations of the package to create
lists that can be accessed concurrently. Since a new instantiation
will create a new node type, you cannot accidently mix nodes.
Have fun!
Geert
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-11-23 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-21 0:00 task safe linked list? Tom Moran
1997-11-23 0:00 ` Geert Bosch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox