libcruft-util/posix/flock.hpp

34 lines
886 B
C++
Raw Normal View History

2022-01-19 07:43:59 +11:00
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2021-2022, Danny Robson <danny@nerdcruft.net>
*/
2022-09-19 11:03:44 +10:00
#pragma once
2022-01-19 07:43:59 +11:00
#include "./fd.hpp"
///////////////////////////////////////////////////////////////////////////////
namespace cruft::posix {
class flock {
public:
flock (cruft::posix::fd const&, int operation);
flock (cruft::posix::fd &&, int operation);
flock (int fd, int operation);
~flock ();
flock (flock&&) noexcept;
flock& operator= (flock&&) noexcept;
flock (flock const&) = delete;
flock& operator= (flock const&) = delete;
cruft::posix::fd const& native (void) const;
private:
cruft::posix::fd m_fd;
};
}