Switched sync.{cpp,h} to std threading primitives.
Summary:
threads: add a thread_local autoconf check
This is a backport of Core PR11722
Test Plan:
make check ninja all check
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Subscribers: teamcity
Differential Revision: https://reviews.bitcoinabc.org/D1903