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

#include <tango/client/ApiUtil.h>
#include <tango/client/EventConsumer.h>
#include <tango/common/PointerWithLock.h>

namespace Tango
{

/********************************************************************************
 *                                                                                 *
 *                         DelayedEventUnsubThread class                            *
 *                                                                                 *
 *******************************************************************************/

// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor)
class DelayedEventUnsubThread : public omni_thread
{
  public:
    DelayedEventUnsubThread(EventConsumer *ec, int id, TangoMonitor *m) :

        event_id(id),
        ev_cons(ApiUtil::instance()->get_locked_event_consumer(ec)),
        the_mon(m)
    {
    }

    void run(void *) override;

  private:
    int event_id;
    PointerWithLock<EventConsumer> ev_cons;
    TangoMonitor *the_mon;

    ~DelayedEventUnsubThread() override = default;
};

} // namespace Tango

#endif
