Changeset 381a53a8 in rtems
- Timestamp:
- Jul 22, 2009, 2:00:09 PM (11 years ago)
- Branches:
- 4.10, 4.11, 5, master
- Children:
- e8d59ca
- Parents:
- e1ffb64
- Location:
- testsuites/psxtests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuites/psxtests/ChangeLog
re1ffb64 r381a53a8 1 2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com> 2 3 * psxcancel/init.c: Clean up. 4 1 5 2009-07-21 Joel Sherrill <joel.sherrill@oarcorp.com> 2 6 -
testsuites/psxtests/psxcancel/init.c
re1ffb64 r381a53a8 1 1 /* 2 * Thread Test Program3 *4 * - test of POSIX's pthread_init() function from rtemstask Init()5 *6 * ott@linux.thai.net7 *8 2 * The license and distribution terms for this file may be 9 3 * found in the file LICENSE in this distribution or at … … 18 12 #include <pthread.h> 19 13 #include <sys/time.h> 20 21 #ifdef __rtems__22 #include <rtems.h>23 /* configuration information */24 25 #define CONFIGURE_INIT26 27 14 #include <unistd.h> 28 15 #include <errno.h> 29 16 #include <sched.h> 30 17 31 #include <bsp.h> /* for device driver prototypes */ 18 19 #if defined(__rtems__) 20 #include <rtems.h> 21 #include <bsp.h> 32 22 #include <pmacros.h> 23 #endif 33 24 34 rtems_task Init( rtems_task_argument argument); 35 36 /* configuration information */ 37 38 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 39 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 40 41 #define CONFIGURE_MAXIMUM_TASKS 3 42 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 43 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) 44 45 #define CONFIGURE_MAXIMUM_POSIX_THREADS 5 46 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 5 47 #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 5 48 49 #include <rtems/console.h> 50 #include <rtems/confdefs.h> 51 52 #endif /* __rtems__ */ 53 54 void countTaskAsync(void); 55 void countTaskDeferred(void); 56 57 void countTaskDeferred(void) 25 void *countTaskDeferred(void *ignored) 58 26 { 59 27 int i=0; … … 66 34 sleep(1); 67 35 pthread_testcancel(); 68 36 } 69 37 } 70 38 71 void countTaskAsync(void)39 void *countTaskAsync(void *ignored) 72 40 { 73 41 int i=0; … … 79 47 printf("countTaskAsync: elapsed time (second): %2d\n", i++ ); 80 48 sleep(1); 81 49 } 82 50 } 83 51 84 #if def __linux__85 int main(){ 52 #if defined(__rtems__) 53 void *POSIX_Init(void *ignored) 86 54 #else 87 rtems_task Init( rtems_task_argument ignored ) {55 int main(int argc, char **argv) 88 56 #endif 89 90 pthread_t count;57 { 58 pthread_t task; 91 59 int taskparameter = 0; 92 60 … … 96 64 { 97 65 int task_ret; 98 task_ret = pthread_create(& count, NULL, (void *) countTaskDeferred, (void *)&taskparameter);66 task_ret = pthread_create(&task, NULL, countTaskDeferred, &taskparameter); 99 67 if (task_ret) { 100 68 perror("pthread_create: countTask"); … … 103 71 /* sleep for 5 seconds, then cancel it */ 104 72 sleep(5); 105 pthread_cancel( count);106 pthread_join( count,NULL);73 pthread_cancel(task); 74 pthread_join(task, NULL); 107 75 } 108 76 … … 110 78 { 111 79 int task_ret; 112 task_ret = pthread_create(& count, NULL, (void *) countTaskAsync, (void *)&taskparameter);80 task_ret = pthread_create(&task, NULL, countTaskAsync, &taskparameter); 113 81 if (task_ret) { 114 82 perror("pthread_create: countTask"); … … 117 85 /* sleep for 5 seconds, then cancel it */ 118 86 sleep(5); 119 pthread_cancel( count);120 pthread_join( count,NULL);87 pthread_cancel(task); 88 pthread_join(task, NULL); 121 89 } 122 90 … … 124 92 puts( "*** END OF POSIX CANCEL TEST ***" ); 125 93 126 #ifdef __linux__ 127 return 0; 128 #else 129 rtems_test_exit(EXIT_SUCCESS); 130 #endif 94 #if defined(__rtems__) 95 rtems_test_exit(EXIT_SUCCESS); 96 return NULL; 97 #else 98 return 0; 99 #endif 131 100 } 101 102 /* configuration information */ 103 #if defined(__rtems__) 104 105 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 106 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 107 108 #define CONFIGURE_MAXIMUM_POSIX_THREADS 2 109 #define CONFIGURE_POSIX_INIT_THREAD_TABLE 110 111 #define CONFIGURE_INIT 112 #include <rtems/confdefs.h> 113 114 #endif /* __rtems__ */ 115
Note: See TracChangeset
for help on using the changeset viewer.