From: Jesse G. <je...@wi...> - 2004-08-22 22:36:47
|
skaller wrote: [...] >> 1.) Now that the list type is gone, how do we grab a VALID >> node if the only node we know about has been invalidated? > > Grab the node you need beforehand. EG: > > let next = node.next in ignore(delete node); > .. do something with 'next' now ... This wouldn't work in a threaded environment. You have no guarantee that next will still be a valid node by the time you try to use it. In the current list implementation this is solved by always having (or being able to retrieve, even from an invalidated node) a pointer to the list type, which in turn always points to a valid head node. This raises an interesting point for me. Are all standard OCaml data structures thread safe by default? -- Jesse Guardiani, Systems Administrator WingNET Internet Services, P.O. Box 2605 // Cleveland, TN 37320-2605 423-559-LINK (v) 423-559-5145 (f) http://www.wingnet.net |