Support multithread server

This commit is contained in:
TXuian
2024-05-31 01:17:57 +08:00
parent d05754a98e
commit 3a99cc550c
8 changed files with 128 additions and 85 deletions

View File

@@ -41,7 +41,7 @@ typedef struct {
uint64_t valid : 1; // for server to peek new msg
uint64_t done : 1; // for client to check request done
uint64_t init : 1; // for client to check request done
uint64_t delayed : 1;
uint64_t handling : 1;
uint64_t nr_args : 4;
uint64_t opcode : 8;
uint64_t len : 16;

View File

@@ -39,7 +39,7 @@ Modification:
static inline bool is_msg_needed(struct IpcMsg* msg)
{
assert(msg != NULL);
return msg->header.magic == IPC_MSG_MAGIC && msg->header.valid == 1 && msg->header.done == 0 && msg->header.delayed == 0;
return msg->header.magic == IPC_MSG_MAGIC && msg->header.valid == 1 && msg->header.done == 0 && msg->header.handling == 0;
}
int sys_poll_session(struct Session* userland_session_arr, int arr_capacity)

View File

@@ -166,6 +166,10 @@ static void _dealloc_task_cb(struct Thread* task)
bitmap64_free(&task->memspace->thread_stack_idx_bitmap, task->thread_context.user_stack_idx);
/* thread's user stack space is also allocated for kernel free space */
assert(kfree((char*)task->thread_context.ustack_kvaddr));
if (task->memspace != NULL) {
task->memspace->mem_size -= USER_STACK_SIZE;
}
}
/* free thread's kernel stack */