Merge pull request #4740 from Guozhanxin/scheduler_check

This commit is contained in:
guo
2022-01-28 16:38:32 +08:00
committed by GitHub
6 changed files with 67 additions and 22 deletions
+11 -1
View File
@@ -144,11 +144,15 @@ int dfs_device_fs_open(struct dfs_fd *file)
{
count ++;
}
rt_exit_critical();
root_dirent = (struct device_dirent *)rt_malloc(sizeof(struct device_dirent) +
count * sizeof(rt_device_t));
if (root_dirent != RT_NULL)
{
/* lock scheduler */
rt_enter_critical();
root_dirent->devices = (rt_device_t *)(root_dirent + 1);
root_dirent->read_index = 0;
root_dirent->device_count = count;
@@ -156,12 +160,18 @@ int dfs_device_fs_open(struct dfs_fd *file)
/* get all device node */
for (node = information->object_list.next; node != &(information->object_list); node = node->next)
{
/* avoid memory write through */
if (count == root_dirent->device_count)
{
rt_kprintf("warning: There are newly added devices that are not displayed!");
break;
}
object = rt_list_entry(node, struct rt_object, list);
root_dirent->devices[count] = (rt_device_t)object;
count ++;
}
rt_exit_critical();
}
rt_exit_critical();
/* set data */
file->data = root_dirent;
+3 -3
View File
@@ -57,6 +57,9 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
rt_thread_t thread;
RT_ASSERT(completion != RT_NULL);
/* current context checking */
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
@@ -82,9 +85,6 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
rt_list_insert_before(&(completion->suspended_list),
&(thread->tlist));
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
/* start timer */
if (timeout > 0)
{
+6 -6
View File
@@ -98,6 +98,9 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
RT_ASSERT(queue != RT_NULL);
RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
/* current context checking */
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
@@ -112,9 +115,6 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
goto __exit;
}
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
/* reset thread error number */
thread->error = RT_EOK;
@@ -217,6 +217,9 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
RT_ASSERT(data_ptr != RT_NULL);
RT_ASSERT(size != RT_NULL);
/* current context checking */
RT_DEBUG_SCHEDULER_AVAILABLE(timeout != 0);
result = RT_EOK;
thread = rt_thread_self();
@@ -230,9 +233,6 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
goto __exit;
}
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
/* reset thread error number */
thread->error = RT_EOK;
+1 -1
View File
@@ -129,7 +129,7 @@ int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec)
rt_base_t level;
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
RT_DEBUG_SCHEDULER_AVAILABLE(RT_TRUE);
tick = rt_tick_from_millisecond(msec);