Thread-safe deletion of a linked list node, using the fine-grained approach

前端 未结 3 1869
忘了有多久
忘了有多久 2021-01-01 06:36

Why is the following snippet for deleting a node in a linked list not thread safe?

edit: note every node has a lock of its own

// ... lock acquisitio         


        
3条回答
  •  耶瑟儿~
    2021-01-01 07:18

    You might wanna take a look at this presentation. From slide #39, it demonstrates how fine-grained linked list locking should be implemented, in a clear and figurative way (the slides' notes add some explanations as well). The presentation is based on (or taken from...) a book called The Art of Multiprocessor Programming.

提交回复
热议问题