[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for pthread cancellation



Do you have a test for pthread_cancel?  Does that stuff work?



Charles-Antoine Gauthier wrote:
> 
> The pthread cancellation fields are not initialized. Here is a patch to
> _POSIX_Threads_Create_extension that fixes the problem.
> 
> Index: pthread.c
> ===================================================================
> RCS file: /home/rtej/CVSRoot/rtems/c/src/exec/posix/src/pthread.c,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- pthread.c   1999/09/10 14:18:41     1.4
> +++ pthread.c   1999/10/13 15:24:18     1.5
> @@ -147,6 +147,14 @@
>    api->schedparam  = _POSIX_Threads_Default_attributes.schedparam;
>    api->schedparam.sched_priority =
>       _POSIX_Priority_From_core( created->current_priority );
> +
> +  /*
> +   *  POSIX 1003.1 1996, 18.2.2.2
> +   */
> +  api->cancelation_requested = 0;
> +  api->cancelability_state = PTHREAD_CANCEL_ENABLE;
> +  api->cancelability_type = PTHREAD_CANCEL_DEFERRED;
> +  _Chain_Initialize_empty (&api->Cancellation_Handlers);
> 
>    /*
>     *  If the thread is not a posix thread, then all posix signals are
> blocked
> Index: ChangeLog
> ===================================================================
> RCS file: /home/rtej/CVSRoot/rtems/ChangeLog,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- ChangeLog   1999/10/12 18:37:26     1.14
> +++ ChangeLog   1999/10/13 15:23:09     1.15
> @@ -1,3 +1,8 @@
> +1999-10-13  Charles-Antoine Gauthier <charles.gauthier at iit.nrc.ca>
> +
> +  * c/src/exec/posix/src/pthread.c(_POSIX_Threads_Create_extension):
> +  Initialize the cancellation support fields in the POSIX_API_Control.
> +
>  1999-10-12  Charles-Antoine Gauthier <charles.gauthier at iit.nrc.ca>
> 
>    * make/custom/mbx8xx.cfg
> 
> --
> Charles-Antoine Gauthier
> Research Officer
> Software Engineering Group
> Institute for Information Technology
> National Research Council of Canada
> Ottawa, ON, Canada
> K1A 0R6

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985