[thread_manager] Add bounds checks.
[thread_manager] Add bounds checks.

fhijaz/Graphite,nkawahara/Graphite,victorisildur/Graphite,nkawahara/Graphite,mit-carbon/Graphite,mit-carbon/Graphite-Cycle-Level,mit-carbon/Graphite-Cycle-Level,nkawahara/Graphite,victorisildur/Graphite,mit-carbon/Graphite-Cycle-Level,mit-carbon/Graphite-Cycle-Level,fhijaz/Graphite,mit-carbon/Graphite,nkawahara/Graphite,8l/Graphite,mit-carbon/Graphite,8l/Graphite,victorisildur/Graphite,victorisildur/Graphite,mit-carbon/Graphite,8l/Graphite,fhijaz/Graphite,fhijaz/Graphite,8l/Graphite