[CPP] Fix segment crashes that caused by race condition of timer in cpp client (#7572)
[CPP] Fix segment crashes that caused by race condition of timer in cpp client (#7572)

* Kevin Wilson changes to fix segment crashes in pulsar

* after merge with master, change following comments: ptr, unnecessary change

* add lock to avoid concurrent access

* Remove comments

Co-authored-by: Isaiah Rairdon <492f74d6abed22c6995497befd6e5eedaf0c2864@microfocus.com>
Co-authored-by: Jia Zhai <5e812ea5c09250beb5273db5cfe2fa31bd4648c5@apache.org>
Co-authored-by: Sijie Guo <1f0a072942b5a6a61c5ea946a8ff638685cedd4a@apache.org>
Co-authored-by: xiaolong.ran <7d13e43fbbc3fc16d27e460280d19c5113a24274@apache.org>
yahoo/pulsar,massakam/pulsar,yahoo/pulsar,merlimat/pulsar,yahoo/pulsar,massakam/pulsar,merlimat/pulsar,massakam/pulsar,massakam/pulsar,merlimat/pulsar,yahoo/pulsar,yahoo/pulsar,massakam/pulsar,yahoo/pulsar,merlimat/pulsar,merlimat/pulsar,merlimat/pulsar,massakam/pulsar