1

Can you please point me to a tutorial for an explanation of the specific "Critical section" implementation that is used in main.cpp. I would like to understand a bit better how does it work. I studied concurrency before so I have some background to be able to understand it.

1

Are you talking about the CCriticalSection class? As you can see in sync.h, it's just a wrapper around Boost's recursive_mutex class. (It looks like the CCriticalSection name comes from Windows.)

You can read all about Boost's threading API in its documentation.

|improve this answer|||||
  • It is more clear now. But is CCriticalSection class related to CRITICAL_BLOCK? Also, what does the cs mean in cs_mapKeys? – user1769523 Aug 24 '14 at 22:00
  • @user1759523: I don't know what CRITICAL_BLOCK is and I see no reference to it in the Bitcoin source. cs is just part of the name of the variable ´cs_mapKeys´ but I assume it is supposed to remind you that it is an object of type CCriticalSection. – Nate Eldredge Aug 24 '14 at 22:05
  • Maybe it was only in previous versions. See: github.com/bitcoin/bitcoin/blob/… – user1769523 Aug 24 '14 at 22:41
  • @user1759523: It looks like this has been replaced by LOCK. But anyway, you can see the code in sync.h; I'm not sure what you want to know specifically. These might be better questions for Stack Overflow since they are more about C++ in general than Bitcoin in particular. – Nate Eldredge Aug 24 '14 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.