Closed alan0526 closed 5 months ago
Sorry, It seems that I use the wrong version.
@alan0526 No worries. We are happy that the issue was solved on its own :smile:
@alan0526 also, be aware that the sample lives long enough if you use the pointer to the payload from another thread. Ideally, the whole sample would be just moved to the thread from the thread pool. This is usually easier to do with the WaitSet than with the Listener since the the server needs to be guarded with a mutex when accessing it from multiple threads, e.g. when sending a response. This cannot be done with the Listener since it also accesses the Server internally from an implicitly started thread.
Is there any example of execute tasks use thread pool in Listener callback of untyped server? I tried to use BS::thread_pool to execute task in parallel, but the server is always crash after handle some requests. This is my code, I use listener in a class: