libcruft-util/posix/flock.hpp

34 lines
886 B
C++

/*
* 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>
*/
#pragma once
#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;
};
}