fix sigslot
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 4m14s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 4m22s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 4m59s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 4m41s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 4m14s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 4m23s

This commit is contained in:
tqcq 2024-12-20 14:23:53 +08:00
parent e1d529e847
commit 40224b51c3

View File

@ -94,6 +94,8 @@
// If signalx is single threaded the user must ensure that disconnect, connect
// or signal is not happening concurrently or data race may occur.
#ifndef __SIGSLOT_H__
#define __SIGSLOT_H__
#ifndef SLED_SIGSLOT_H
#define SLED_SIGSLOT_H
#pragma once
@ -203,31 +205,29 @@ private:
class multi_threaded_local {
public:
// multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }
multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }
//
// multi_threaded_local(const multi_threaded_local &)
// {
// pthread_mutex_init(&m_mutex, nullptr);
// }
//
// ~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }
multi_threaded_local(const multi_threaded_local &) { pthread_mutex_init(&m_mutex, nullptr); }
~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }
void lock()
{
mutex_.Lock();
// pthread_mutex_lock(&m_mutex);
// mutex_.Lock();
pthread_mutex_lock(&m_mutex);
}
void unlock()
{
mutex_.Unlock();
// pthread_mutex_unlock(&m_mutex);
// mutex_.Unlock();
pthread_mutex_unlock(&m_mutex);
}
private:
sled::RecursiveMutex mutex_;
// sled::RecursiveMutex mutex_;
// sled::Mutex mutex_;
// pthread_mutex_t m_mutex;
pthread_mutex_t m_mutex;
};
#endif// _SIGSLOT_HAS_POSIX_THREADS
@ -665,3 +665,4 @@ using signal8 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7,
}// namespace sigslot
#endif// SLED_SIGSLOT_H
#endif// __SIGSLOT_H__