|
|
|
|
|
by alexgartrell
5812 days ago
|
|
I think the answer is actually pretty straightforward. It's trivial to go from a serial to a threaded server. It's way harder to write an event-based server using poll or select. Serially: int handle_connection(int fd) {
...
}
int loop() {
...
while(1) {
fd = accept(listener);
handle_connection(fd);
}
}
Threaded: int handle_connection(int fd) {
...
}
int loop() {
...
while(1) {
fd = accept(listener);
thread_start(handle_connection, fd);
}
}
|
|
Evented: