A question about some code from TBB book, Thanks.

Posted by Jackie on Stack Overflow See other posts from Stack Overflow or by Jackie
Published on 2010-04-20T16:44:08Z Indexed on 2010/04/20 16:53 UTC
Read the original article Hit count: 389

Filed under:
|

I am reading the book: Intel Threading Building Blocks. I often have difficulties understanding them. For example,the following code is from the book(page 112):

Node* AllocateNode() {
Node* n;
FreeListMutexType::scoped_lock lock;
lock.acquire(FreeListMutex);
n=FreeList;
if(n)
Freelist=n->next;
lock.release();
if(!n)
n=new Node();

return n;
}

There is other introduction regarding this code. I can not understand it. What does it means? How can I understand this book better? Thanks.

© Stack Overflow or respective owner

Related posts about c++

Related posts about tbb