2

ex 1 cs_m : critical section. The thing is, even knowing 'm' stands for mutex, a google search of cs mutex doesn't lead to critical section, the meaning of cs as it turns out.

ex 2 pto : I'm guessing it stands for 'pointer o' but what's the o, and where can I become more literate in the codebase as far as chosen variables and expressions are concerned? C++ reference material obvious doesn't refer/handle our naming conventions.

Edit: I am referring to Bitcoin Core. For example2. pto appears 63 times in src/net_processing.cpp - first on Line 4927

0

1 Answer 1

1

These are very generic names whose meaning is completely context specific.

Likely, where you saw pto, it was a pointer type and there was somewhere nearby a variable called o.

Similarly, a critical section is just a chunk of code proteceted by a mutex. Knowing that cs_m is a mutex is just about as good as knowing that it's a critical section mutex.

So for these, it pretty much doesn't matter what they mean. Just looking at how they're used in the chunk of code that uses them should give you all the insight possible and knowing how the name was chosen doesn't add very much, if anything.

1
  • FWIW, pto means "pointer to to", as in a pointer to the data structure corresponding to the node we're sending to. Jan 28, 2023 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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