Replies: 3 comments 9 replies
-
Hi @codingcai, thanks for the kind words :) To your questions. The endpoinds, or better instances of endpoints, are not thread-safe. You either need to guard the instance by a mutex or need to instantiate multiple instances. The reason for this is that each instance tracks the the memory it loaned and these structures are not thread-safe since it would affect performance when nit needed and can easily made thread-safe when needed, e.g. via a The server knows the ID of the client which sent the request and responds only to that client. It is also possible to set a sequence ID if you have multiple threads accessing the same client. The corresponding response will have the same ID. You just need to provide the response to the right thread. To your second question. Using the Hope this answers gelp you :) |
Beta Was this translation helpful? Give feedback.
-
I also have another problem. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi ,
Thank you very much for providing such a great project. I encountered two issues when I started using it and would like to seek some advice.
1) When I make a request in a multi-threaded context, how can I differentiate on the server side which thread from the client made the request, so that the response can be returned to the correct thread? In the iceoryx_examples, during client initialization, an application is initialized with
iox::runtime::PoshRuntime::initRuntime(APP_NAME)
, which further initializes a client :iox::popo::Client<AddRequest, AddResponse> client({"Example", "Request-Response", "Add"});
. If I use a multi-threaded client, do I need to create a client for each thread? Would this allow the server to differentiate between them?2)I have a requirement where, on the client side, I allocate a buffer with
char *buffer = (char *)malloc(N * sizeof(char))
write content into it, and then I want to send this content to the server as a string. How can I send this to minimize data copying? Should I use the built-in string from iceoryx?Thank you very much :-)
Beta Was this translation helpful? Give feedback.
All reactions