mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-14 05:09:34 +08:00
TIMEOUT(9): Start callout timer later
This avoid race conditions during initialization.
This commit is contained in:
parent
da450ab3dc
commit
7f1836cfe6
@ -216,7 +216,9 @@ cc_cme_migrating(struct callout_cpu *cc)
|
|||||||
* and may be called more then once.
|
* and may be called more then once.
|
||||||
*/
|
*/
|
||||||
#ifdef __rtems__
|
#ifdef __rtems__
|
||||||
static void rtems_bsd_timeout_init(void *);
|
static void rtems_bsd_timeout_init_early(void *);
|
||||||
|
|
||||||
|
static void callout_cpu_init(struct callout_cpu *);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rtems_bsd_callout_timer(rtems_id id, void *arg)
|
rtems_bsd_callout_timer(rtems_id id, void *arg)
|
||||||
@ -231,13 +233,29 @@ rtems_bsd_callout_timer(rtems_id id, void *arg)
|
|||||||
callout_tick();
|
callout_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void callout_cpu_init(struct callout_cpu *);
|
static void
|
||||||
|
rtems_bsd_timeout_init_late(void *unused)
|
||||||
|
{
|
||||||
|
rtems_status_code sc;
|
||||||
|
rtems_id id;
|
||||||
|
|
||||||
SYSINIT(rtems_bsd_timeout, SI_SUB_VM, SI_ORDER_FIRST, rtems_bsd_timeout_init,
|
(void) unused;
|
||||||
NULL);
|
|
||||||
|
sc = rtems_timer_create(rtems_build_name('_', 'C', 'L', 'O'), &id);
|
||||||
|
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
||||||
|
|
||||||
|
sc = rtems_timer_server_fire_after(id, 1, rtems_bsd_callout_timer, NULL);
|
||||||
|
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSINIT(rtems_bsd_timeout_early, SI_SUB_VM, SI_ORDER_FIRST,
|
||||||
|
rtems_bsd_timeout_init_early, NULL);
|
||||||
|
|
||||||
|
SYSINIT(rtems_bsd_timeout_late, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST,
|
||||||
|
rtems_bsd_timeout_init_late, NULL);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rtems_bsd_timeout_init(void *unused)
|
rtems_bsd_timeout_init_early(void *unused)
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
caddr_t
|
caddr_t
|
||||||
kern_timeout_callwheel_alloc(caddr_t v)
|
kern_timeout_callwheel_alloc(caddr_t v)
|
||||||
@ -245,8 +263,6 @@ kern_timeout_callwheel_alloc(caddr_t v)
|
|||||||
{
|
{
|
||||||
struct callout_cpu *cc;
|
struct callout_cpu *cc;
|
||||||
#ifdef __rtems__
|
#ifdef __rtems__
|
||||||
rtems_status_code sc;
|
|
||||||
rtems_id id;
|
|
||||||
caddr_t v;
|
caddr_t v;
|
||||||
|
|
||||||
(void) unused;
|
(void) unused;
|
||||||
@ -275,12 +291,6 @@ kern_timeout_callwheel_alloc(caddr_t v)
|
|||||||
return(v);
|
return(v);
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
callout_cpu_init(cc);
|
callout_cpu_init(cc);
|
||||||
|
|
||||||
sc = rtems_timer_create(rtems_build_name('_', 'C', 'L', 'O'), &id);
|
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
sc = rtems_timer_server_fire_after(id, 1, rtems_bsd_callout_timer, NULL);
|
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user