Increment the thread-local sample counter. See the `asprof_thread_local_data` docs. This function *is* async-signal safe, and therefore will not initialize the thread-local storage by itself, but will rather do nothing if it's not initialized already. This works fine with the `sample_counter` API since only changes in `sample_counter` matter.
| 17 | // storage by itself, but will rather do nothing if it's not initialized already. This works |
| 18 | // fine with the `sample_counter` API since only changes in `sample_counter` matter. |
| 19 | static void incrementSampleCounter(void) { |
| 20 | if (_profiler_data_key == -1) return; |
| 21 | |
| 22 | asprof_thread_local_data* data = (asprof_thread_local_data*) pthread_getspecific(_profiler_data_key); |
| 23 | if (data != NULL) { |
| 24 | data->sample_counter++; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // Get the `asprof_thread_local_data`. See the `asprof_get_thread_local_data` docs. |
| 29 | static asprof_thread_local_data* getThreadLocalData(void) { |
nothing calls this directly
no outgoing calls
no test coverage detected