Add check for thread notification in message_stream