lib: Replace lists with arrays to store read and write threads
With arrays, a thread corresponding to given fd is looked up in constant time
versus the linear time taken for list traversals.
Signed-off-by: Denil Vira <denil@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/lib/thread.h b/lib/thread.h
index 5bc756c..5a3bf7d 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -48,13 +48,14 @@
/* Master of the theads. */
struct thread_master
{
- struct thread_list read;
- struct thread_list write;
+ struct thread **read;
+ struct thread **write;
struct pqueue *timer;
struct thread_list event;
struct thread_list ready;
struct thread_list unuse;
struct pqueue *background;
+ int fd_limit;
fd_set readfd;
fd_set writefd;
fd_set exceptfd;