Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: jodicksons on June 25, 2017, 03:59:11 PM



Title: Small questions about source code
Post by: jodicksons on June 25, 2017, 03:59:11 PM
Hello everyone, I am currently going through the bitcoin source code and each of the functions etc..

I would like to know more about the LOCK() function.

I see a lot of them and while using my search function, can't seem to find it's origin.

I know it is about threads and "locking access" to certain vars but would like to read how it is implemented.

If anybody know where to find the definition of the LOCK or CRITICAL_BLOCK function, it would be greatly appreciated.

example :

 LOCK(csPathCached);


Title: Re: Small questions about source code
Post by: achow101 on June 25, 2017, 05:23:05 PM
Those are actually macros, not functions. They are defined here: https://github.com/bitcoin/bitcoin/blob/master/src/sync.h


Title: Re: Small questions about source code
Post by: jodicksons on June 25, 2017, 06:12:21 PM
Thank you.