[
https://issues.apache.org/jira/browse/TS-4680?focusedWorklogId=25726&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-25726
]
ASF GitHub Bot logged work on TS-4680:
--------------------------------------
Author: ASF GitHub Bot
Created on: 19/Jul/16 23:54
Start Date: 19/Jul/16 23:54
Worklog Time Spent: 10m
Work Description: Github user jpeach commented on the issue:
https://github.com/apache/trafficserver/pull/815
These are globals, so I don't think that thread local storage makes sense
here.
There are 2 reasonable approaches to this. The most straight-forward is to
use static initialization (which is guaranteed to be thread-safe by the
[language](http://en.cppreference.com/w/cpp/language/storage_duration)).
Alternatively, we could use ``pthread_once`` directly.
For example, using the first alternative:
```C
const char *
TSFooDirGet()
{
static const char * path = ReadFooDirPath();
return path;
}
```
Issue Time Tracking
-------------------
Worklog Id: (was: 25726)
Time Spent: 0.5h (was: 20m)
> Not thread safe initialization in TS*DirGet() functions
> -------------------------------------------------------
>
> Key: TS-4680
> URL: https://issues.apache.org/jira/browse/TS-4680
> Project: Traffic Server
> Issue Type: Bug
> Components: TS API
> Reporter: Pavlo Yatsukhnenko
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)