mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 00:49:42 +08:00
kern/sleepqueue: Update due to API changes
This commit is contained in:
parent
e5aa554ea1
commit
1bf6529d19
@ -381,7 +381,7 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
|
|||||||
sq->sq_blockedcnt[queue]++;
|
sq->sq_blockedcnt[queue]++;
|
||||||
#ifdef __rtems__
|
#ifdef __rtems__
|
||||||
executing = td->td_thread;
|
executing = td->td_thread;
|
||||||
_Thread_Lock_acquire_default(executing, &lock_context);
|
_Thread_Wait_acquire_default(executing, &lock_context);
|
||||||
td->td_sq_state = TD_SQ_TIRED;
|
td->td_sq_state = TD_SQ_TIRED;
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
td->td_sleepqueue = NULL;
|
td->td_sleepqueue = NULL;
|
||||||
@ -395,7 +395,7 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
|
|||||||
}
|
}
|
||||||
thread_unlock(td);
|
thread_unlock(td);
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
_Thread_Lock_release_default(executing, &lock_context);
|
_Thread_Wait_release_default(executing, &lock_context);
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ sleepq_switch(void *wchan, int pri)
|
|||||||
|
|
||||||
sleepq_release(wchan);
|
sleepq_release(wchan);
|
||||||
|
|
||||||
executing = _Thread_Lock_acquire_default_for_executing(&lock_context);
|
executing = _Thread_Wait_acquire_default_for_executing(&lock_context);
|
||||||
td = rtems_bsd_get_thread(executing);
|
td = rtems_bsd_get_thread(executing);
|
||||||
BSD_ASSERT(td != NULL);
|
BSD_ASSERT(td != NULL);
|
||||||
|
|
||||||
@ -640,11 +640,11 @@ sleepq_switch(void *wchan, int pri)
|
|||||||
bool unblock;
|
bool unblock;
|
||||||
|
|
||||||
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
||||||
_Thread_Lock_release_default(executing, &lock_context);
|
_Thread_Wait_release_default(executing, &lock_context);
|
||||||
|
|
||||||
_Thread_Set_state(executing, STATES_WAITING_FOR_BSD_WAKEUP);
|
_Thread_Set_state(executing, STATES_WAITING_FOR_BSD_WAKEUP);
|
||||||
|
|
||||||
_Thread_Lock_acquire_default(executing, &lock_context);
|
_Thread_Wait_acquire_default(executing, &lock_context);
|
||||||
|
|
||||||
unblock = false;
|
unblock = false;
|
||||||
switch (td->td_sq_state) {
|
switch (td->td_sq_state) {
|
||||||
@ -665,7 +665,7 @@ sleepq_switch(void *wchan, int pri)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Thread_Lock_release_default(executing, &lock_context);
|
_Thread_Wait_release_default(executing, &lock_context);
|
||||||
|
|
||||||
if (unblock) {
|
if (unblock) {
|
||||||
_Thread_Timer_remove(executing);
|
_Thread_Timer_remove(executing);
|
||||||
@ -674,7 +674,7 @@ sleepq_switch(void *wchan, int pri)
|
|||||||
|
|
||||||
_Thread_Dispatch_enable(cpu_self);
|
_Thread_Dispatch_enable(cpu_self);
|
||||||
|
|
||||||
_Thread_Lock_acquire_default(executing, &lock_context);
|
_Thread_Wait_acquire_default(executing, &lock_context);
|
||||||
|
|
||||||
switch (td->td_sq_state) {
|
switch (td->td_sq_state) {
|
||||||
case TD_SQ_NIGHTMARE:
|
case TD_SQ_NIGHTMARE:
|
||||||
@ -689,7 +689,7 @@ sleepq_switch(void *wchan, int pri)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_Thread_Lock_release_default(executing, &lock_context);
|
_Thread_Wait_release_default(executing, &lock_context);
|
||||||
|
|
||||||
if (remove) {
|
if (remove) {
|
||||||
sleepq_remove(td, wchan);
|
sleepq_remove(td, wchan);
|
||||||
@ -924,7 +924,7 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
|
|||||||
(void)sc;
|
(void)sc;
|
||||||
thread = td->td_thread;
|
thread = td->td_thread;
|
||||||
_ISR_lock_ISR_disable(&lock_context);
|
_ISR_lock_ISR_disable(&lock_context);
|
||||||
_Thread_Lock_acquire_default_critical(thread, &lock_context);
|
_Thread_Wait_acquire_default_critical(thread, &lock_context);
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
td->td_wmesg = NULL;
|
td->td_wmesg = NULL;
|
||||||
@ -971,14 +971,14 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
|
|||||||
Per_CPU_Control *cpu_self;
|
Per_CPU_Control *cpu_self;
|
||||||
|
|
||||||
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
||||||
_Thread_Lock_release_default(thread, &lock_context);
|
_Thread_Wait_release_default(thread, &lock_context);
|
||||||
|
|
||||||
_Thread_Timer_remove(thread);
|
_Thread_Timer_remove(thread);
|
||||||
_Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP);
|
_Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP);
|
||||||
|
|
||||||
_Thread_Dispatch_enable(cpu_self);
|
_Thread_Dispatch_enable(cpu_self);
|
||||||
} else {
|
} else {
|
||||||
_Thread_Lock_release_default(thread, &lock_context);
|
_Thread_Wait_release_default(thread, &lock_context);
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
return (0);
|
return (0);
|
||||||
@ -1180,7 +1180,7 @@ sleepq_timeout(Watchdog_Control *watchdog)
|
|||||||
BSD_ASSERT(td != NULL);
|
BSD_ASSERT(td != NULL);
|
||||||
|
|
||||||
_ISR_lock_ISR_disable(&lock_context);
|
_ISR_lock_ISR_disable(&lock_context);
|
||||||
_Thread_Lock_acquire_default_critical(thread, &lock_context);
|
_Thread_Wait_acquire_default_critical(thread, &lock_context);
|
||||||
|
|
||||||
unblock = false;
|
unblock = false;
|
||||||
switch (td->td_sq_state) {
|
switch (td->td_sq_state) {
|
||||||
@ -1200,13 +1200,13 @@ sleepq_timeout(Watchdog_Control *watchdog)
|
|||||||
Per_CPU_Control *cpu_self;
|
Per_CPU_Control *cpu_self;
|
||||||
|
|
||||||
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
|
||||||
_Thread_Lock_release_default(thread, &lock_context);
|
_Thread_Wait_release_default(thread, &lock_context);
|
||||||
|
|
||||||
_Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP);
|
_Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP);
|
||||||
|
|
||||||
_Thread_Dispatch_enable(cpu_self);
|
_Thread_Dispatch_enable(cpu_self);
|
||||||
} else {
|
} else {
|
||||||
_Thread_Lock_release_default(thread, &lock_context);
|
_Thread_Wait_release_default(thread, &lock_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user