EmbLogic's Blog

Creating N-number of threads specified in the command line by the user and each of them will display a message and it’s thread-id

RCS file: N_threads.c,v
Working file: N_threads.c
head: 1.10
branch:
locks: strict
root: 1.10
access list:
symbolic names:
keyword substitution: kv
total revisions: 10;    selected revisions: 10
description:
Code that will create N number of threads specified in the command line,each of which prints
out a hello message and its own thread-id.
—————————-
revision 1.10    locked by: root;
date: 2014/01/23 13:39:32;  author: root;  state: Exp;  lines: +4 -2
Logical error fixed.
The program is creating N number of threads specified by the user.
After a thread is created it is displaying a message and it’s thread-id.
—————————-
revision 1.9
date: 2014/01/23 13:22:38;  author: root;  state: Exp;  lines: +1 -1
Bug fixed.
Issue:The program is not linked with the pthreads library.
—————————-
revision 1.8
date: 2014/01/23 13:06:52;  author: root;  state: Exp;  lines: +10 -3
Definition for the display function is added.
pthread_exit() and pthread_join() system calls are added in the program.
After comilation:Error is undefined reference to pthread.
—————————-
revision 1.7
date: 2014/01/22 23:00:58;  author: root;  state: Exp;  lines: +1 -1
Declaration error is fixed.
Issue:ret_val variable which will store the return value from pthread_create() is undeclared.
—————————-
revision 1.6
date: 2014/01/22 22:59:38;  author: root;  state: Exp;  lines: +1 -0
Prototype for the display_message() is added in the code.
—————————-
revision 1.5
date: 2014/01/22 22:56:15;  author: root;  state: Exp;  lines: +1 -0
Header file:<pthread.h> is included to support pthread functions and data structures.
—————————-
revision 1.4
date: 2014/01/22 22:54:14;  author: root;  state: Exp;  lines: +15 -2
The N number of threads will get created by using the for loop in the main thread.
pthread_create() system call is used to create a thread.
—————————-
revision 1.3
date: 2014/01/22 22:40:39;  author: root;  state: Exp;  lines: +4 -1
The number of threads that will be given as an input by the user is converted from string to int
using sscanf() successfully.
—————————-
revision 1.2
date: 2014/01/22 22:15:13;  author: root;  state: Exp;  lines: +2 -2
Two arguments are passed to main().The first is the number of arguments supplied to the program
and second is an array of pointers to strings.
—————————-
revision 1.1
date: 2014/01/22 22:10:19;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>