/*
 * SPDX-FileCopyrightText: 2025 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */
#ifndef TANGO_SERVER_WRITERLOCK_H
#define TANGO_SERVER_WRITERLOCK_H

#include <tango/server/ReadersWritersLock.h>

namespace Tango
{
/**
 * RAII class for holding a ReadersWritersLock with `writerIn()` and `writerOut()`.
 */
class WriterLock
{
    ReadersWritersLock &rwl;

  public:
    WriterLock(ReadersWritersLock &l) :
        rwl(l)
    {
        rwl.writerIn();
    }

    ~WriterLock()
    {
        rwl.writerOut();
    }
};
} // namespace Tango
#endif
