KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am creating a multithreaded server using epoll (edge-triggered) and non-blocking sockets. Currently I'm creating an event loop on the main thread and waiting for notifications and it works correctly I have to choose between two approaches to make it multithreaded: Create an event loop for each thread and add the server socket's file descriptor to look for notifications on each thread. (is that possible? I mean: is epoll thread-safe?) Create a single event loop and wait for notifications. Whenever a notification is received, spawn a thread to handle it. If I use the first method, is there a chance for multiple threads to get notified with the same event? how can I handle this situation? What could be the best approach? Thank you.
Tags (comma-separated)
Save Edits
Cancel