diff options
author | frosch <frosch@openttd.org> | 2015-03-07 18:27:01 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2015-03-07 18:27:01 +0000 |
commit | 780e5959331b39eda19868126af41398a904818b (patch) | |
tree | e2d592a1b2ec24af7ae1190c9ef970289b2e8e03 /src/linkgraph/linkgraphjob.cpp | |
parent | e77de936366fd4a0773386b8bdbe5bd6da354c89 (diff) | |
download | openttd-780e5959331b39eda19868126af41398a904818b.tar.xz |
(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.
Diffstat (limited to 'src/linkgraph/linkgraphjob.cpp')
-rw-r--r-- | src/linkgraph/linkgraphjob.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/linkgraph/linkgraphjob.cpp b/src/linkgraph/linkgraphjob.cpp index 30d68e4d8..20cbf3f64 100644 --- a/src/linkgraph/linkgraphjob.cpp +++ b/src/linkgraph/linkgraphjob.cpp @@ -22,6 +22,13 @@ LinkGraphJobPool _link_graph_job_pool("LinkGraphJob"); INSTANTIATE_POOL_METHODS(LinkGraphJob) /** + * Static instance of an invalid path. + * Note: This instance is created on task start. + * Lazy creation on first usage results in a data race between the CDist threads. + */ +/* static */ Path *Path::invalid_path = new Path(INVALID_NODE, true); + +/** * Create a link graph job from a link graph. The link graph will be copied so * that the calculations don't interfer with the normal operations on the * original. The job is immediately started. |