On 22.02.2018 20:18, Georg Chini wrote: > On 22.02.2018 17:15, Raman Shyshniou wrote: >> Currently the pipe-source will remain running even if no >> writer is connected and therefore no data is produced. >> This patch prevets this by auto-suspending source >> when all writers are disconnected. >> --- >> Â src/modules/module-pipe-source.c | 190 >> ++++++++++++++++++++++++++++++++------- >> Â 1 file changed, 156 insertions(+), 34 deletions(-) >> > I believe you need some user_unsuspended and/or auto_unsuspended > flag that is set in the SET_STATE handler to handle the first data read > after suspend correctly. > > When you unsuspend from auto suspend, the first chunk you already read > from the pipe should be posted - as far as I can see this happens. > > However, when you unsuspend from user suspend, the data in the pipe may > be old - you did not read anything during suspend. Therefore the first > chunk > you read should be discarded. That does not happen as far as I can > tell. Or > am I overlooking something (again)? Maybe you can simply drain the pipe in the SET_STATE handler when waking up from user suspend. Then you need no extra logic in the thread function.