Multithreaded access to the data in a tree
I want to create binary search tree data structure in C/C++ where each node holds some data (objects or pointers). I will access this tree in multi-threading environment, If I can guarantee that each thread will access (read)开发者_开发百科 different subtrees/paths/nodes of the tree, than it is thread-safe to modify objects (or data pointers point to) stored in nodes and so I can avoid locking?
Locking is not the goal, providing exclusive access to a resources is. Locking is a means of achieving that goal. You've stated you can achieve that goal by some other means. Using this other means would be as thread-safe as using locks would be.
精彩评论