From 958a6180674359e371053780ad1af2ab8d0425ab Mon Sep 17 00:00:00 2001 From: fpagliughi Date: Thu, 4 Jul 2024 19:13:52 -0400 Subject: [PATCH] #418 Fixed broken/bad merge --- include/mqtt/token.h | 5 +---- src/token.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/mqtt/token.h b/include/mqtt/token.h index a2b5d657..6ffcb994 100644 --- a/include/mqtt/token.h +++ b/include/mqtt/token.h @@ -400,10 +400,7 @@ class token * Register a listener to be notified when an action completes. * @param listener The callback to be notified when actions complete. */ - virtual void set_action_callback(iaction_listener& listener) { - guard g(lock_); - listener_ = &listener; - } + virtual void set_action_callback(iaction_listener& listener); /** * Store some context associated with an action. * @param userContext optional object used to pass context to the diff --git a/src/token.cpp b/src/token.cpp index 08edca7e..e7781e6f 100644 --- a/src/token.cpp +++ b/src/token.cpp @@ -1,7 +1,7 @@ // token.cpp /******************************************************************************* - * Copyright (c) 2013-2019 Frank Pagliughi + * Copyright (c) 2013-2024 Frank Pagliughi * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 @@ -257,13 +257,12 @@ void token::reset() errMsg_.clear(); } -void set_action_callback(iaction_listener& listener) +void token::set_action_callback(iaction_listener& listener) { - guard g(lock_); + unique_lock g{lock_}; listener_ = &listener; - if (complete_) - { + if (complete_) { g.unlock(); if (rc_ == MQTTASYNC_SUCCESS)