mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
add ipc pipe (#28)
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include <sched/sched.h>
|
||||
#include <process/process.h>
|
||||
#include <mm/slab.h>
|
||||
#include <common/spinlock.h>
|
||||
|
||||
/**
|
||||
* @brief 初始化等待队列
|
||||
@ -30,6 +31,22 @@ void wait_queue_sleep_on(wait_queue_node_t *wait_queue_head)
|
||||
sched_cfs();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 在等待队列上进行等待,同时释放自旋锁
|
||||
*
|
||||
* @param wait_queue_head 队列头指针
|
||||
*/
|
||||
void wait_queue_sleep_on_unlock(wait_queue_node_t *wait_queue_head,
|
||||
void *lock)
|
||||
{
|
||||
wait_queue_node_t *wait = (wait_queue_node_t *)kmalloc(sizeof(wait_queue_node_t), 0);
|
||||
wait_queue_init(wait, current_pcb);
|
||||
current_pcb->state = PROC_UNINTERRUPTIBLE;
|
||||
list_append(&wait_queue_head->wait_list, &wait->wait_list);
|
||||
spin_unlock((spinlock_t *)lock);
|
||||
sched_cfs();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 在等待队列上进行等待(允许中断)
|
||||
*
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include <common/glib.h>
|
||||
// #include <common/spinlock.h>
|
||||
|
||||
// #include <process/process.h>
|
||||
/**
|
||||
* @brief 信号量的等待队列
|
||||
@ -26,6 +28,13 @@ void wait_queue_init(wait_queue_node_t *wait_queue, struct process_control_block
|
||||
*/
|
||||
void wait_queue_sleep_on(wait_queue_node_t * wait_queue_head);
|
||||
|
||||
/**
|
||||
* @brief 在等待队列上进行等待,同时释放自旋锁
|
||||
*
|
||||
* @param wait_queue_head 队列头指针
|
||||
*/
|
||||
void wait_queue_sleep_on_unlock(wait_queue_node_t *wait_queue_head,
|
||||
void *lock);
|
||||
/**
|
||||
* @brief 在等待队列上进行等待(允许中断)
|
||||
*
|
||||
|
Reference in New Issue
Block a user