Changeset 68799a2a in rtems


Ignore:
Timestamp:
Jul 21, 2009, 1:17:59 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
75eaf66
Parents:
d374492
Message:

2009-07-21 Santosh G Vattam <vattam.santosh@…>

  • posix/Makefile.am, posix/include/rtems/posix/cancel.h, posix/src/cancel.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c: Add _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch method to avoid duplication of code and ease coverage analysis.
  • posix/src/canceleval.c: New file.
Location:
cpukit
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rd374492 r68799a2a  
     12009-07-21      Santosh G Vattam <vattam.santosh@gmail.com>
     2
     3        * posix/Makefile.am, posix/include/rtems/posix/cancel.h,
     4        posix/src/cancel.c, posix/src/setcancelstate.c,
     5        posix/src/setcanceltype.c: Add
     6        _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch method to
     7        avoid duplication of code and ease coverage analysis.
     8        * posix/src/canceleval.c: New file.
     9
    1102009-07-20      Joel Sherrill <joel.sherrill@OARcorp.com>
    211
  • cpukit/posix/Makefile.am

    rd374492 r68799a2a  
    7070
    7171## CANCEL_C_FILES
    72 libposix_a_SOURCES += src/cancel.c src/cancelrun.c src/cleanuppop.c \
    73     src/cleanuppush.c src/setcancelstate.c src/setcanceltype.c \
    74     src/testcancel.c
     72libposix_a_SOURCES += src/cancel.c src/canceleval.c src/cancelrun.c \
     73    src/cleanuppop.c src/cleanuppush.c src/setcancelstate.c \
     74    src/setcanceltype.c src/testcancel.c
    7575
    7676## CONDITION_VARIABLE_C_FILES
  • cpukit/posix/include/rtems/posix/cancel.h

    rd374492 r68799a2a  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2009.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    1616#ifndef _RTEMS_POSIX_CANCEL_H
    1717#define _RTEMS_POSIX_CANCEL_H
     18
     19#include <rtems/posix/threadsup.h>
    1820
    1921typedef struct {
     
    3638);
    3739
     40/*
     41 *  _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch
     42 *
     43 *  DESCRIPTION:
     44 * 
     45 *  This routine separates a piece of code that existed as part of
     46 *  another routine, but had to be separated to improve coverage.
     47 */
     48
     49void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch (
     50  POSIX_API_Control *thread_support
     51);
     52
    3853#endif
    3954/* end of include file */
  • cpukit/posix/src/cancel.c

    rd374492 r68799a2a  
    2626#include <rtems/posix/threadsup.h>
    2727
    28 /*PAGE
    29  *
     28/*
    3029 *  18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
    3130 */
     
    3837  POSIX_API_Control  *thread_support;
    3938  Objects_Locations   location;
    40   bool                cancel = false;
    4139
    4240  /*
     
    5553      thread_support->cancelation_requested = 1;
    5654
    57       if (thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
    58           thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS)
    59         cancel = true;
    60 
    61       _Thread_Enable_dispatch();
    62       if ( cancel )
    63         _POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
     55      _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
    6456      return 0;
    6557
  • cpukit/posix/src/setcancelstate.c

    rd374492 r68799a2a  
    11/*
    2  *  COPYRIGHT (c) 1989-2008.
     2 *  COPYRIGHT (c) 1989-2009.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    2121#include <rtems/score/isr.h>
    2222#include <rtems/score/thread.h>
    23 #include <rtems/score/wkspace.h>
    2423#include <rtems/posix/cancel.h>
    2524#include <rtems/posix/pthread.h>
    2625#include <rtems/posix/threadsup.h>
    2726
    28 /*PAGE
    29  *
     27/*
    3028 *  18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
    3129 */
     
    3735{
    3836  POSIX_API_Control *thread_support;
    39   bool               cancel = false;
    4037
    4138  /*
     
    6057    thread_support->cancelability_state = state;
    6158
    62     if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
    63          thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
    64          thread_support->cancelation_requested )
    65       cancel = true;
     59  _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
    6660
    67  _Thread_Enable_dispatch();
    68  if ( cancel )
    69    _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
     61  /*
     62   *  _Thread_Enable_dispatch is invoked by above call.
     63   */
     64
    7065  return 0;
    7166}
  • cpukit/posix/src/setcanceltype.c

    rd374492 r68799a2a  
    11/*
    2  *  COPYRIGHT (c) 1989-2008.
     2 *  COPYRIGHT (c) 1989-2009.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    2121#include <rtems/score/isr.h>
    2222#include <rtems/score/thread.h>
    23 #include <rtems/score/wkspace.h>
    2423#include <rtems/posix/cancel.h>
    2524#include <rtems/posix/pthread.h>
    2625#include <rtems/posix/threadsup.h>
    2726
    28 /*PAGE
    29  *
     27/*
    3028 *  18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
    3129 */
     
    3735{
    3836  POSIX_API_Control *thread_support;
    39   bool               cancel = false;
    4037
    4138  /*
     
    6057    thread_support->cancelability_type = type;
    6158
    62     if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
    63          thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
    64          thread_support->cancelation_requested )
    65       cancel = true;
    66   _Thread_Enable_dispatch();
    67   if ( cancel )
    68     _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
    69 
     59    _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
     60 
     61  /*
     62   *  _Thread_Enable_dispatch is invoked by above call.
     63   */
    7064  return 0;
    7165}
Note: See TracChangeset for help on using the changeset viewer.