forked from Imagelibrary/rtems
Use PRIxpthread_t to print pthread_t's.
This commit is contained in:
@@ -45,7 +45,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init: ID is 0x%08x\n", Init_id );
|
printf( "Init: ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* exercise get minimum priority */
|
/* exercise get minimum priority */
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void *Task_1_through_3(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Task_id = pthread_self();
|
Task_id = pthread_self();
|
||||||
printf( "Task_1: ID is 0x%08x\n", Task_id );
|
printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
|
||||||
|
|
||||||
/* exercise pthread_equal */
|
/* exercise pthread_equal */
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* install a signal handler */
|
/* install a signal handler */
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ void Signal_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal: %d caught by 0x%x (%d)\n",
|
"Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -53,7 +53,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* install a signal handler */
|
/* install a signal handler */
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void Signal_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal: %d caught by 0x%x (%d)\n",
|
"Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -45,7 +45,7 @@ void Signal_info_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal_info: %d caught by 0x%x (%d) si_signo= %d si_code= %d value= %d\n",
|
"Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count,
|
Signal_count,
|
||||||
@@ -78,7 +78,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* generate some easy error cases */
|
/* generate some easy error cases */
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* tes pthread_mutex_attr_init */
|
/* tes pthread_mutex_attr_init */
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* create a couple of threads */
|
/* create a couple of threads */
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* exercise init and destroy */
|
/* exercise init and destroy */
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
puts( "Init: pthread_detach - ESRCH (invalid id)" );
|
puts( "Init: pthread_detach - ESRCH (invalid id)" );
|
||||||
status = pthread_detach( (pthread_t) -1 );
|
status = pthread_detach( (pthread_t) -1 );
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* try to use this thread as a sporadic server */
|
/* try to use this thread as a sporadic server */
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void *Task_1(
|
|||||||
/* wait for a condition variable signal from Init */
|
/* wait for a condition variable signal from Init */
|
||||||
|
|
||||||
Task_id = pthread_self();
|
Task_id = pthread_self();
|
||||||
printf( "Task_1: ID is 0x%08x\n", Task_id );
|
printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
|
||||||
|
|
||||||
status = pthread_mutex_init( &Mutex_id, NULL );
|
status = pthread_mutex_init( &Mutex_id, NULL );
|
||||||
assert( !status );
|
assert( !status );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void *Task_2(
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
Task_id = pthread_self();
|
Task_id = pthread_self();
|
||||||
printf( "Task_2: ID is 0x%08x\n", Task_id );
|
printf( "Task_2: ID is 0x%08" PRIxpthread_t "\n", Task_id );
|
||||||
|
|
||||||
status = pthread_mutex_lock( &Mutex_id );
|
status = pthread_mutex_lock( &Mutex_id );
|
||||||
assert( !status );
|
assert( !status );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void *Task_3(
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
Task_id = pthread_self();
|
Task_id = pthread_self();
|
||||||
printf( "Task_3: ID is 0x%08x\n", Task_id );
|
printf( "Task_3: ID is 0x%08" PRIxpthread_t "\n", Task_id );
|
||||||
|
|
||||||
status = pthread_mutex_lock( &Mutex_id );
|
status = pthread_mutex_lock( &Mutex_id );
|
||||||
assert( !status );
|
assert( !status );
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* exercise pthread_setschedparam */
|
/* exercise pthread_setschedparam */
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
/* invalid scheduling policy error */
|
/* invalid scheduling policy error */
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void Signal_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal: %d caught by 0x%x (%d)\n",
|
"Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -45,7 +45,7 @@ void Signal_info_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal_info: %d caught by 0x%x (%d) si_signo= %d si_code= %d value= %d\n",
|
"Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count,
|
Signal_count,
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ void *BarrierThread(void *arg)
|
|||||||
pthread_t id = *(pthread_t *) arg;
|
pthread_t id = *(pthread_t *) arg;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
printf( "pthread_barrier_wait( &Barrier ) for thread 0x%08x\n", id );
|
printf( "pthread_barrier_wait( &Barrier ) for thread 0x%08" PRIxpthread_t "\n", id );
|
||||||
status = pthread_barrier_wait( &Barrier );
|
status = pthread_barrier_wait( &Barrier );
|
||||||
printf( "pthread_barrier_wait - 0x%08x released\n", id );
|
printf( "pthread_barrier_wait - 0x%08" PRIxpthread_t " released\n", id );
|
||||||
assert( (status == 0) || (status == PTHREAD_BARRIER_SERIAL_THREAD) );
|
assert( (status == 0) || (status == PTHREAD_BARRIER_SERIAL_THREAD) );
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
Allocate_majority_of_workspace(84);
|
Allocate_majority_of_workspace(84);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void *Task_1(
|
|||||||
int status;
|
int status;
|
||||||
uint32_t *key_data;
|
uint32_t *key_data;
|
||||||
|
|
||||||
printf( "Thread 0x%08x\n", id );
|
printf( "Thread 0x%08" PRIxpthread_t "\n", id );
|
||||||
printf( "Task_1: Setting the key to %d\n", 1 );
|
printf( "Task_1: Setting the key to %d\n", 1 );
|
||||||
status = pthread_setspecific( Key_id[0], (void *)&Data_array[ 1 ] );
|
status = pthread_setspecific( Key_id[0], (void *)&Data_array[ 1 ] );
|
||||||
if ( status )
|
if ( status )
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
Allocate_majority_of_workspace(NAME_MAX);
|
Allocate_majority_of_workspace(NAME_MAX);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void Handler_1(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Handler_1: Signal: %d caught by 0x%x (%d)\n",
|
"Handler_1: Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -40,7 +40,7 @@ void Signal_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal: %d caught by 0x%x (%d)\n",
|
"Signal: %d caught by 0x%"PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -56,7 +56,7 @@ void Signal_info_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal_info: %d caught by 0x%x (%d) si_signo= %d si_code= %d value= %d\n",
|
"Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count,
|
Signal_count,
|
||||||
@@ -97,7 +97,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
Signal_occurred = 0;
|
Signal_occurred = 0;
|
||||||
Signal_count = 0;
|
Signal_count = 0;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void Signal_handler(
|
|||||||
{
|
{
|
||||||
Signal_count++;
|
Signal_count++;
|
||||||
printf(
|
printf(
|
||||||
"Signal: %d caught by 0x%x (%d)\n",
|
"Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
|
||||||
signo,
|
signo,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
Signal_count
|
Signal_count
|
||||||
@@ -63,7 +63,7 @@ void *POSIX_Init(
|
|||||||
/* get id of this thread */
|
/* get id of this thread */
|
||||||
|
|
||||||
Init_id = pthread_self();
|
Init_id = pthread_self();
|
||||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
|
||||||
|
|
||||||
Signal_occurred = 0;
|
Signal_occurred = 0;
|
||||||
Signal_count = 0;
|
Signal_count = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user