Ticket #2068: rtems-PR#2068-pthreadcreate-4.9.diff

File rtems-PR#2068-pthreadcreate-4.9.diff, 1.3 KB (added by strauman, on Jun 19, 2012 at 2:13:22 AM)

fix; patch for 4.9

Line 
1*** cpukit/posix/src/pthreadcreate.c.orig       2012-06-13 11:24:45.000000002 -0700
2--- cpukit/posix/src/pthreadcreate.c    2012-06-13 11:26:36.000000002 -0700
3***************
4*** 237,242 ****
5--- 237,244 ----
6     *  POSIX threads are allocated and started in one operation.
7     */
8 
9+   _Thread_Disable_dispatch();
10+
11    status = _Thread_Start(
12      the_thread,
13      THREAD_START_POINTER,
14***************
15*** 245,257 ****
16      0                     /* unused */
17    );
18 
19-   if ( schedpolicy == SCHED_SPORADIC ) {
20-     _Watchdog_Insert_ticks(
21-       &api->Sporadic_timer,
22-       _Timespec_To_ticks( &api->schedparam.ss_replenish_period )
23-     );
24-   }
25-
26    /*
27     *  _Thread_Start only fails if the thread was in the incorrect state
28     * 
29--- 247,252 ----
30***************
31*** 260,270 ****
32--- 255,275 ----
33     */
34 
35    if ( !status ) {
36+     _Thread_Enable_dispatch();
37      _POSIX_Threads_Free( the_thread );
38      _RTEMS_Unlock_allocator();
39      return EINVAL;
40    }
41 
42+   if ( schedpolicy == SCHED_SPORADIC ) {
43+     _Watchdog_Insert_ticks(
44+       &api->Sporadic_timer,
45+       _Timespec_To_ticks( &api->schedparam.ss_replenish_period )
46+     );
47+   }
48+
49+   _Thread_Enable_dispatch();
50+
51    /*
52     *  Return the id and indicate we successfully created the thread
53     */