Change proc_mgmt/pending_clients.h to use reply queues instead of hashtables.
[barrelfish] / usr / proc_mgmt / spawnd_state.h
index a14fd0f..4d801ab 100644 (file)
 #include <if/spawn_defs.h>
 #include <barrelfish/barrelfish.h>
 
-// TODO(razvan): Use a hash map instead.
-#define MAX_SPAWNDS 256
+struct spawnd_state;
+struct msg_queue_elem;
+typedef bool (*msg_cont_handler_fn)(struct msg_queue_elem*);
+
+struct msg_queue_elem {
+       void *st;
+       msg_cont_handler_fn cont;
+
+    struct msg_queue_elem *next;
+};
+
+struct msg_queue {
+    struct msg_queue_elem *head, *tail;
+};
 
 struct spawnd_state {
+    coreid_t core_id;
     struct spawn_binding *b;
-    // TODO(razvan): will need more state here.
+
+    struct msg_queue sendq;
+    struct msg_queue recvq;
 };
 
 errval_t spawnd_state_alloc(coreid_t core_id, struct spawn_binding *b);
 void spawnd_state_free(coreid_t core_id);
 bool spawnd_state_exists(coreid_t core_id);
-struct spawn_binding *spawnd_state_get_binding(coreid_t core_id);
+struct spawnd_state *spawnd_state_get(coreid_t core_id);
+
+errval_t spawnd_state_enqueue_send(struct spawnd_state *spawnd,
+                                   struct msg_queue_elem *msg);
+void *spawnd_state_dequeue_recv(struct spawnd_state *spawnd);
 
 #endif  // SPAWND_STATE