Revert "fix(pulseaudio): add mutex for queue"
This reverts commit d430174f0b
.
Mutual exclusion is already guaranteed by the lock on
pa_threaded_mainloop
Fixes #1139
This commit is contained in:
parent
428e54e0f6
commit
36ea6fbff8
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.h>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
@ -19,8 +18,6 @@ typedef struct pa_threaded_mainloop pa_threaded_mainloop;
|
|||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
class logger;
|
class logger;
|
||||||
|
|
||||||
using mutex = std::mutex;
|
|
||||||
|
|
||||||
DEFINE_ERROR(pulseaudio_error);
|
DEFINE_ERROR(pulseaudio_error);
|
||||||
|
|
||||||
class pulseaudio {
|
class pulseaudio {
|
||||||
@ -72,8 +69,6 @@ class pulseaudio {
|
|||||||
pa_threaded_mainloop* m_mainloop{nullptr};
|
pa_threaded_mainloop* m_mainloop{nullptr};
|
||||||
|
|
||||||
queue m_events;
|
queue m_events;
|
||||||
mutable mutex m_mutex;
|
|
||||||
|
|
||||||
|
|
||||||
// specified sink name
|
// specified sink name
|
||||||
string spec_s_name;
|
string spec_s_name;
|
||||||
|
@ -112,8 +112,6 @@ bool pulseaudio::wait() {
|
|||||||
* Process queued pulseaudio events
|
* Process queued pulseaudio events
|
||||||
*/
|
*/
|
||||||
int pulseaudio::process_events() {
|
int pulseaudio::process_events() {
|
||||||
std::lock_guard<mutex> lock(m_mutex);
|
|
||||||
|
|
||||||
int ret = m_events.size();
|
int ret = m_events.size();
|
||||||
pa_threaded_mainloop_lock(m_mainloop);
|
pa_threaded_mainloop_lock(m_mainloop);
|
||||||
pa_operation *o{nullptr};
|
pa_operation *o{nullptr};
|
||||||
@ -248,7 +246,6 @@ void pulseaudio::subscribe_callback(pa_context *, pa_subscription_event_type_t t
|
|||||||
return;
|
return;
|
||||||
switch(t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
|
switch(t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
|
||||||
case PA_SUBSCRIPTION_EVENT_SINK:
|
case PA_SUBSCRIPTION_EVENT_SINK:
|
||||||
std::lock_guard<mutex> lock(This->m_mutex);
|
|
||||||
switch(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) {
|
switch(t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) {
|
||||||
case PA_SUBSCRIPTION_EVENT_NEW:
|
case PA_SUBSCRIPTION_EVENT_NEW:
|
||||||
This->m_events.emplace(evtype::NEW);
|
This->m_events.emplace(evtype::NEW);
|
||||||
|
Loading…
Reference in New Issue
Block a user