March 2019
Intermediate to advanced
336 pages
9h 9m
English
The InOrderTraverseTree method of the BinarySearchTree class takes function as a parameter. The RLock method of the lock instance is invoked. The RUnlock method of the tree's lock instance is deferred. InOrderTraverseTree is invoked with the rootNode of the tree and function as parameters:
//InOrderTraverseTree methodfunc (tree *BinarySearchTree) InOrderTraverseTree(function func(int)) { tree.lock.RLock() defer tree.lock.RUnlock() inOrderTraverseTree(tree.rootNode, function)}
Read now
Unlock full access