aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-17 17:17:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-17 17:17:55 +0200
commit4ca5a5bc2991438602d3b1fdb56b91d2b425c52d (patch)
treeb9a2f6f801031af9299bfc45095eac1eb3ceb495 /libbuild2/target.hxx
parentab4a9ef42e8f1070dcb5d783a5afccd2f685e86d (diff)
Fix race in path/mtime assignment and file_rule::match()
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 6022274..55b8270 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -1460,6 +1460,9 @@ namespace build2
// Note also that while we can cache the mtime, it may be ignored if the
// target state is set to group (see above).
//
+ // NOTE: if setting both path and mtime (typically during match), then use
+ // the path_target::path_mtime() function to do it in the correct order.
+ //
void
mtime (timestamp) const;
@@ -1547,12 +1550,22 @@ namespace build2
// lock the target in some other way; see file_rule) so in this case it
// makes sense to set the timestamp first.
//
+ // NOTE: if setting both path and mtime (typically during match), then use
+ // the path_mtime() function to do it in the correct order.
+ //
const path_type&
path () const;
const path_type&
path (path_type) const;
+ // Set both path and mtime and in the correct order.
+ //
+ const path_type&
+ path_mtime (path_type, timestamp) const;
+
+ // Load mtime using the cached path.
+ //
timestamp
load_mtime () const;