diff options
Diffstat (limited to 'libbuild2/file-cache.ixx')
-rw-r--r-- | libbuild2/file-cache.ixx | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/libbuild2/file-cache.ixx b/libbuild2/file-cache.ixx index 1a01410..8385c90 100644 --- a/libbuild2/file-cache.ixx +++ b/libbuild2/file-cache.ixx @@ -3,72 +3,27 @@ namespace build2 { - // file_cache::write - // - inline void file_cache::write:: - close () - { - entry_->state_ = entry::uncomp; - } - - inline file_cache::write:: - ~write () - { - if (entry_ != nullptr) - entry_->unpin (); - } - - inline file_cache::write:: - write (write&& e) - : entry_ (e.entry_) - { - e.entry_ = nullptr; - } - - inline file_cache::write& file_cache::write:: - operator= (write&& e) - { - if (this != &e) - { - assert (entry_ == nullptr); - swap (entry_, e.entry_); - } - return *this; - } - - // file_cache::read + // file_cache::entry // - inline file_cache::read:: - ~read () - { - if (entry_ != nullptr) - entry_->unpin (); - } - - inline file_cache::read:: - read (read&& e) - : entry_ (e.entry_) + inline const path& file_cache::entry:: + path () const { - e.entry_ = nullptr; + return path_; } - inline file_cache::read& file_cache::read:: - operator= (read&& e) + inline void file_cache::entry:: + pin () { - if (this != &e) - { - assert (entry_ == nullptr); - swap (entry_, e.entry_); - } - return *this; + ++pin_; } - // file_cache::entry - // - inline const path& file_cache::entry:: - path () const + inline void file_cache::entry:: + unpin () { - return path_; + if (--pin_ == 0 && + !comp_path_.empty () && + (state_ == uncomp || state_ == decomp)) + preempt (); } inline file_cache::read file_cache::entry:: @@ -86,21 +41,6 @@ namespace build2 return read (*this); } - inline void file_cache::entry:: - pin () - { - ++pin_; - } - - inline void file_cache::entry:: - unpin () - { - if (--pin_ == 0 && - !comp_path_.empty () && - (state_ == uncomp || state_ == decomp)) - preempt (); - } - inline file_cache::entry:: operator bool () const { @@ -149,6 +89,66 @@ namespace build2 return *this; } + // file_cache::write + // + inline void file_cache::write:: + close () + { + entry_->state_ = entry::uncomp; + } + + inline file_cache::write:: + ~write () + { + if (entry_ != nullptr) + entry_->unpin (); + } + + inline file_cache::write:: + write (write&& e) + : entry_ (e.entry_) + { + e.entry_ = nullptr; + } + + inline file_cache::write& file_cache::write:: + operator= (write&& e) + { + if (this != &e) + { + assert (entry_ == nullptr); + swap (entry_, e.entry_); + } + return *this; + } + + // file_cache::read + // + inline file_cache::read:: + ~read () + { + if (entry_ != nullptr) + entry_->unpin (); + } + + inline file_cache::read:: + read (read&& e) + : entry_ (e.entry_) + { + e.entry_ = nullptr; + } + + inline file_cache::read& file_cache::read:: + operator= (read&& e) + { + if (this != &e) + { + assert (entry_ == nullptr); + swap (entry_, e.entry_); + } + return *this; + } + // file_cache // inline file_cache::entry file_cache:: |