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

#include <tango/server/ReadersWritersLock.h>

//
// RAII class for holding a ReadersWritersLock with `readerIn()` and
// `readerOut()`.
//

namespace Tango
{
class ReaderLock
{
    ReadersWritersLock &rwl;

  public:
    ReaderLock(ReadersWritersLock &l) :
        rwl(l)
    {
        rwl.readerIn();
    }

    ~ReaderLock()
    {
        rwl.readerOut();
    }
};
} // namespace Tango
#endif
