uSockets: how to post events to uSockets running thread #1735
Replies: 2 comments
-
You posted on the uWebSockets Discussions page, but you don't mention anything about WebSockets. If you really are using uWebSockets, then see the defer function. If you are using uSockets without uWebSockets, then I don't know the answer. I'm not sure where you should ask since I see no Discussion page at https://github.com/uNetworking/uSockets |
Beta Was this translation helpful? Give feedback.
-
You shouldn't have more than one thread. Use the same event loop for all protocols and you have one single thread for all. You can compile uSockets with libuv support or Boost ASIO support to allow seamless integration on the same thread. But if you absolutely must, Loop::defer posts such an event but this is way slower than single thread shared event loop |
Beta Was this translation helpful? Give feedback.
-
Hello, I fully understand that uSockets is running in one thread.
My app has other threads though (needs to use other communication protocols..).
So, I have a uSockets TCP connection between a client and a server, only sending some messages from one to the other from time to time. Is it possible to post an event to uSockets thread loop to tell it that there is something ready to be sent?
I could see that there is
us_wake_loop
that could be call from another thread, but then which callback will that trigger?Beta Was this translation helpful? Give feedback.
All reactions