Skip to content

Commit

Permalink
print threadId
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavan21 committed Oct 5, 2019
1 parent 096231f commit 73eaf8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions thread_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ void funct1(void)
int local_counter = 0;
while(1)
{
get_threadId(Curr_Thread);
printf("in func1 global_counter = %d, local_counter = %d\n",global_counter++,local_counter++);
yield();
}
Expand All @@ -17,6 +18,7 @@ void funct2(void)
int local_counter = 0;
while(1)
{
get_threadId(Curr_Thread);
printf("in func2 global_counter = %d, local_counter = %d\n",global_counter++,local_counter++);
yield();
}
Expand Down
2 changes: 1 addition & 1 deletion threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void yield() // similar to run

void get_threadId(TCB_t *tcb) {
if(tcb) {
printf("Thread Id is %d\n", tcb->thread_id);
printf("Thread Id is %d and ", tcb->thread_id);
}
}

0 comments on commit 73eaf8b

Please sign in to comment.