There will be a new callback named set_state_in_io_thread(). It seems
like a good idea to have a similar name for the main thread variant.
---
 src/modules/alsa/alsa-sink.c                 |  4 ++--
 src/modules/alsa/alsa-source.c               |  4 ++--
 src/modules/echo-cancel/module-echo-cancel.c |  8 ++++----
 src/modules/macosx/module-coreaudio-device.c |  8 ++++----
 src/modules/module-combine-sink.c            |  4 ++--
 src/modules/module-equalizer-sink.c          |  4 ++--
 src/modules/module-ladspa-sink.c             |  4 ++--
 src/modules/module-remap-sink.c              |  4 ++--
 src/modules/module-remap-source.c            |  4 ++--
 src/modules/module-tunnel.c                  |  8 ++++----
 src/modules/module-virtual-sink.c            |  4 ++--
 src/modules/module-virtual-source.c          |  8 ++++----
 src/modules/module-virtual-surround-sink.c   |  4 ++--
 src/pulsecore/sink.c                         | 12 ++++++------
 src/pulsecore/sink.h                         |  9 +++++----
 src/pulsecore/source.c                       | 12 ++++++------
 src/pulsecore/source.h                       |  9 +++++----
 17 files changed, 56 insertions(+), 54 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 309d726e8..dca8f6939 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1230,7 +1230,7 @@ static int sink_process_msg(pa_msgobject *o, int code, 
void *data, int64_t offse
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t new_state, 
pa_suspend_cause_t new_suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t 
new_state, pa_suspend_cause_t new_suspend_cause) {
     pa_sink_state_t old_state;
     struct userdata *u;
 
@@ -2359,7 +2359,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, 
const char*driver, pa_ca
     u->sink->parent.process_msg = sink_process_msg;
     if (u->use_tsched)
         u->sink->update_requested_latency = sink_update_requested_latency_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     if (u->ucm_context)
         u->sink->set_port = sink_set_port_ucm_cb;
     else
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index adaa42cb3..b3adc7e79 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1085,7 +1085,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 }
 
 /* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t new_state, 
pa_suspend_cause_t new_suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t 
new_state, pa_suspend_cause_t new_suspend_cause) {
     pa_source_state_t old_state;
     struct userdata *u;
 
@@ -2035,7 +2035,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs 
*ma, const char*driver, p
     u->source->parent.process_msg = source_process_msg;
     if (u->use_tsched)
         u->source->update_requested_latency = 
source_update_requested_latency_cb;
-    u->source->set_state = source_set_state_cb;
+    u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
     if (u->ucm_context)
         u->source->set_port = source_set_port_ucm_cb;
     else
diff --git a/src/modules/echo-cancel/module-echo-cancel.c 
b/src/modules/echo-cancel/module-echo-cancel.c
index 8e416563f..7af2f4b22 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -477,7 +477,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_source_assert_ref(s);
@@ -502,7 +502,7 @@ static int source_set_state_cb(pa_source *s, 
pa_source_state_t state, pa_suspend
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -1875,7 +1875,7 @@ int pa__init(pa_module*m) {
     }
 
     u->source->parent.process_msg = source_process_msg_cb;
-    u->source->set_state = source_set_state_cb;
+    u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
     u->source->update_requested_latency = source_update_requested_latency_cb;
     pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
     if (!u->use_volume_sharing) {
@@ -1925,7 +1925,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
diff --git a/src/modules/macosx/module-coreaudio-device.c 
b/src/modules/macosx/module-coreaudio-device.c
index f9ef7c5a0..149109d4f 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -353,7 +353,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
     return pa_source_process_msg(o, code, data, offset, chunk);;
 }
 
-static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int ca_sink_set_state_in_main_thread(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     coreaudio_sink *sink = s->userdata;
 
     switch (state) {
@@ -498,7 +498,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer 
*buf, int channel_idx
 
     sink->parent.process_msg = sink_process_msg;
     sink->userdata = ca_sink;
-    sink->set_state = ca_sink_set_state;
+    sink->set_state_in_main_thread = ca_sink_set_state_in_main_thread;
 
     pa_sink_set_asyncmsgq(sink, u->thread_mq.inq);
     pa_sink_set_rtpoll(sink, u->rtpoll);
@@ -511,7 +511,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer 
*buf, int channel_idx
     return 0;
 }
 
-static int ca_source_set_state(pa_source *s, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int ca_source_set_state_in_main_thread(pa_source *s, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause) {
     coreaudio_source *source = s->userdata;
 
     switch (state) {
@@ -632,7 +632,7 @@ static int ca_device_create_source(pa_module *m, 
AudioBuffer *buf, int channel_i
 
     source->parent.process_msg = source_process_msg;
     source->userdata = ca_source;
-    source->set_state = ca_source_set_state;
+    source->set_state_in_main_thread = ca_source_set_state_in_main_thread;
 
     pa_source_set_asyncmsgq(source, u->thread_mq.inq);
     pa_source_set_rtpoll(source, u->rtpoll);
diff --git a/src/modules/module-combine-sink.c 
b/src/modules/module-combine-sink.c
index 7a80028ae..22800a8bb 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -680,7 +680,7 @@ static void unsuspend(struct userdata *u) {
 }
 
 /* Called from main context */
-static int sink_set_state(pa_sink *sink, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *sink, pa_sink_state_t 
state, pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(sink);
@@ -1425,7 +1425,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg;
-    u->sink->set_state = sink_set_state;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency;
     u->sink->userdata = u;
 
diff --git a/src/modules/module-equalizer-sink.c 
b/src/modules/module-equalizer-sink.c
index bcc8dafe9..efe95b3fb 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -285,7 +285,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -1229,7 +1229,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 4d5cd68f3..a2db68e1c 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -392,7 +392,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -1297,7 +1297,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c
index f063576f2..ec6698795 100644
--- a/src/modules/module-remap-sink.c
+++ b/src/modules/module-remap-sink.c
@@ -112,7 +112,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void 
*data, int64_t offse
 }
 
 /* Called from main context */
-static int sink_set_state(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -410,7 +410,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg;
-    u->sink->set_state = sink_set_state;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread;
     u->sink->update_requested_latency = sink_update_requested_latency;
     u->sink->request_rewind = sink_request_rewind;
     u->sink->userdata = u;
diff --git a/src/modules/module-remap-source.c 
b/src/modules/module-remap-source.c
index 88eccc221..8901eb905 100644
--- a/src/modules/module-remap-source.c
+++ b/src/modules/module-remap-source.c
@@ -108,7 +108,7 @@ static int source_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t
 }
 
 /* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_source_assert_ref(s);
@@ -367,7 +367,7 @@ int pa__init(pa_module*m) {
     }
 
     u->source->parent.process_msg = source_process_msg_cb;
-    u->source->set_state = source_set_state_cb;
+    u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
     u->source->update_requested_latency = source_update_requested_latency_cb;
 
     u->source->userdata = u;
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 1db79ef60..a9f26ad70 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -568,7 +568,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void 
*data, int64_t offse
 }
 
 /* Called from main context */
-static int sink_set_state(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
     pa_sink_assert_ref(s);
     u = s->userdata;
@@ -670,7 +670,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 }
 
 /* Called from main context */
-static int source_set_state(pa_source *s, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
     pa_source_assert_ref(s);
     u = s->userdata;
@@ -2156,7 +2156,7 @@ int pa__init(pa_module*m) {
 
     u->sink->parent.process_msg = sink_process_msg;
     u->sink->userdata = u;
-    u->sink->set_state = sink_set_state;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
 
@@ -2199,7 +2199,7 @@ int pa__init(pa_module*m) {
     }
 
     u->source->parent.process_msg = source_process_msg;
-    u->source->set_state = source_set_state;
+    u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
     u->source->userdata = u;
 
 /*     pa_source_set_latency_range(u->source, MIN_NETWORK_LATENCY_USEC, 0); */
diff --git a/src/modules/module-virtual-sink.c 
b/src/modules/module-virtual-sink.c
index 5fa4ce4d3..ca6ce5696 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -124,7 +124,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -555,7 +555,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
diff --git a/src/modules/module-virtual-source.c 
b/src/modules/module-virtual-source.c
index c002ae843..c40ffb616 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -111,7 +111,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -194,7 +194,7 @@ static int source_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t
 }
 
 /* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_source_assert_ref(s);
@@ -579,7 +579,7 @@ int pa__init(pa_module*m) {
     }
 
     u->source->parent.process_msg = source_process_msg_cb;
-    u->source->set_state = source_set_state_cb;
+    u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
     u->source->update_requested_latency = source_update_requested_latency_cb;
     pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
     if (!use_volume_sharing) {
@@ -667,7 +667,7 @@ int pa__init(pa_module*m) {
         u->sink->parent.process_msg = sink_process_msg_cb;
         u->sink->update_requested_latency = sink_update_requested_latency_cb;
         u->sink->request_rewind = sink_request_rewind_cb;
-        u->sink->set_state = sink_set_state_cb;
+        u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
         u->sink->userdata = u;
 
         pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq);
diff --git a/src/modules/module-virtual-surround-sink.c 
b/src/modules/module-virtual-surround-sink.c
index 876d618e1..00780d8bd 100644
--- a/src/modules/module-virtual-surround-sink.c
+++ b/src/modules/module-virtual-surround-sink.c
@@ -152,7 +152,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, 
void *data, int64_t of
 }
 
 /* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause) {
     struct userdata *u;
 
     pa_sink_assert_ref(s);
@@ -729,7 +729,7 @@ int pa__init(pa_module*m) {
     }
 
     u->sink->parent.process_msg = sink_process_msg_cb;
-    u->sink->set_state = sink_set_state_cb;
+    u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index f19e8b09e..6549515b5 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -150,7 +150,7 @@ void pa_sink_new_data_done(pa_sink_new_data *data) {
 static void reset_callbacks(pa_sink *s) {
     pa_assert(s);
 
-    s->set_state = NULL;
+    s->set_state_in_main_thread = NULL;
     s->get_volume = NULL;
     s->set_volume = NULL;
     s->write_volume = NULL;
@@ -427,9 +427,9 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t 
state, pa_suspend_cause_t
      * cause, or it might just add unnecessary complexity, given that the
      * current approach of not setting any suspend cause works well enough. */
 
-    if (s->set_state) {
-        ret = s->set_state(s, state, suspend_cause);
-        /* set_state() is allowed to fail only when resuming. */
+    if (s->set_state_in_main_thread) {
+        ret = s->set_state_in_main_thread(s, state, suspend_cause);
+        /* set_state_in_main_thread() is allowed to fail only when resuming. */
         pa_assert(ret >= 0 || resuming);
     }
 
@@ -438,8 +438,8 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t 
state, pa_suspend_cause_t
             /* SET_STATE is allowed to fail only when resuming. */
             pa_assert(resuming);
 
-            if (s->set_state)
-                s->set_state(s, PA_SINK_SUSPENDED, 0);
+            if (s->set_state_in_main_thread)
+                s->set_state_in_main_thread(s, PA_SINK_SUSPENDED, 0);
         }
 
     if (suspend_cause_changed) {
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index b7e21f9f0..0caeb550b 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -132,10 +132,11 @@ struct pa_sink {
      * s->state and s->suspend_cause haven't been updated yet when this is
      * called, so the callback can get the old state through those variables.
      *
-     * If set_state() is successful, the IO thread will be notified with the
-     * SET_STATE message. The message handler is allowed to fail, in which
-     * case the old state is restored, and set_state() is called again. */
-    int (*set_state)(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t 
suspend_cause); /* may be NULL */
+     * If set_state_in_main_thread() is successful, the IO thread will be
+     * notified with the SET_STATE message. The message handler is allowed to
+     * fail, in which case the old state is restored, and
+     * set_state_in_main_thread() is called again. */
+    int (*set_state_in_main_thread)(pa_sink *s, pa_sink_state_t state, 
pa_suspend_cause_t suspend_cause); /* may be NULL */
 
     /* Sink drivers that support hardware volume may set this
      * callback. This is called when the current volume needs to be
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 7ea75ff05..ad8e5e364 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -141,7 +141,7 @@ void pa_source_new_data_done(pa_source_new_data *data) {
 static void reset_callbacks(pa_source *s) {
     pa_assert(s);
 
-    s->set_state = NULL;
+    s->set_state_in_main_thread = NULL;
     s->get_volume = NULL;
     s->set_volume = NULL;
     s->write_volume = NULL;
@@ -381,9 +381,9 @@ static int source_set_state(pa_source *s, pa_source_state_t 
state, pa_suspend_ca
      * cause, or it might just add unnecessary complexity, given that the
      * current approach of not setting any suspend cause works well enough. */
 
-    if (s->set_state) {
-        ret = s->set_state(s, state, suspend_cause);
-        /* set_state() is allowed to fail only when resuming. */
+    if (s->set_state_in_main_thread) {
+        ret = s->set_state_in_main_thread(s, state, suspend_cause);
+        /* set_state_in_main_thread() is allowed to fail only when resuming. */
         pa_assert(ret >= 0 || resuming);
     }
 
@@ -392,8 +392,8 @@ static int source_set_state(pa_source *s, pa_source_state_t 
state, pa_suspend_ca
             /* SET_STATE is allowed to fail only when resuming. */
             pa_assert(resuming);
 
-            if (s->set_state)
-                s->set_state(s, PA_SOURCE_SUSPENDED, 0);
+            if (s->set_state_in_main_thread)
+                s->set_state_in_main_thread(s, PA_SOURCE_SUSPENDED, 0);
         }
 
     if (suspend_cause_changed) {
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index ea3147255..d60e8a1a8 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -133,10 +133,11 @@ struct pa_source {
      * s->state and s->suspend_cause haven't been updated yet when this is
      * called, so the callback can get the old state through those variables.
      *
-     * If set_state() is successful, the IO thread will be notified with the
-     * SET_STATE message. The message handler is allowed to fail, in which
-     * case the old state is restored, and set_state() is called again. */
-    int (*set_state)(pa_source *source, pa_source_state_t state, 
pa_suspend_cause_t suspend_cause); /* may be NULL */
+     * If set_state_in_main_thread() is successful, the IO thread will be
+     * notified with the SET_STATE message. The message handler is allowed to
+     * fail, in which case the old state is restored, and
+     * set_state_in_main_thread() is called again. */
+    int (*set_state_in_main_thread)(pa_source *source, pa_source_state_t 
state, pa_suspend_cause_t suspend_cause); /* may be NULL */
 
     /* Called when the volume is queried. Called from main loop
      * context. If this is NULL a PA_SOURCE_MESSAGE_GET_VOLUME message
-- 
2.16.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to