Changeset 7f1836c in rtems-libbsd


Ignore:
Timestamp:
Nov 13, 2013, 3:16:29 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, eeb3fd5d9b07ac9a2e280cff60a1b762bd273a8d, freebsd-9.3, 1e989998de954bef51e6c19cc3d64d39f32100aa
Children:
c2f6513
Parents:
da450ab
git-author:
Sebastian Huber <sebastian.huber@…> (11/13/13 15:16:29)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/13/13 16:44:40)
Message:

TIMEOUT(9): Start callout timer later

This avoid race conditions during initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/kern/kern_timeout.c

    rda450ab r7f1836c  
    217217 */
    218218#ifdef __rtems__
    219 static void rtems_bsd_timeout_init(void *);
     219static void rtems_bsd_timeout_init_early(void *);
     220
     221static void callout_cpu_init(struct callout_cpu *);
    220222
    221223static void
     
    232234}
    233235
    234 static void callout_cpu_init(struct callout_cpu *);
    235 
    236 SYSINIT(rtems_bsd_timeout, SI_SUB_VM, SI_ORDER_FIRST, rtems_bsd_timeout_init,
    237     NULL);
    238 
    239236static void
    240 rtems_bsd_timeout_init(void *unused)
     237rtems_bsd_timeout_init_late(void *unused)
     238{
     239        rtems_status_code sc;
     240        rtems_id id;
     241
     242        (void) unused;
     243
     244        sc = rtems_timer_create(rtems_build_name('_', 'C', 'L', 'O'), &id);
     245        BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
     246
     247        sc = rtems_timer_server_fire_after(id, 1, rtems_bsd_callout_timer, NULL);
     248        BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
     249}
     250
     251SYSINIT(rtems_bsd_timeout_early, SI_SUB_VM, SI_ORDER_FIRST,
     252    rtems_bsd_timeout_init_early, NULL);
     253
     254SYSINIT(rtems_bsd_timeout_late, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST,
     255    rtems_bsd_timeout_init_late, NULL);
     256
     257static void
     258rtems_bsd_timeout_init_early(void *unused)
    241259#else /* __rtems__ */
    242260caddr_t
     
    246264        struct callout_cpu *cc;
    247265#ifdef __rtems__
    248         rtems_status_code sc;
    249         rtems_id id;
    250266        caddr_t v;
    251267
     
    276292#else /* __rtems__ */
    277293        callout_cpu_init(cc);
    278 
    279         sc = rtems_timer_create(rtems_build_name('_', 'C', 'L', 'O'), &id);
    280         BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
    281 
    282         sc = rtems_timer_server_fire_after(id, 1, rtems_bsd_callout_timer, NULL);
    283         BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
    284294#endif /* __rtems__ */
    285295}
Note: See TracChangeset for help on using the changeset viewer.