EmbLogic's Blog

Code to demonstrate how to pass integer data to a thread.

RCS file: passing_data_to_threads.c,v
Working file: passing_data_to_threads.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9;    selected revisions: 9
description:
Code to demonstrate how to pass data to threads.
—————————-
revision 1.9    locked by: root;
date: 2014/01/23 00:42:31;  author: root;  state: Exp;  lines: +2 -4
Logical bug fixed.
Issue:Type casting is done incorrectly.
The data is passed to a thread and is getting displayed by the thread successfully.
—————————-
revision 1.8
date: 2014/01/23 00:31:32;  author: root;  state: Exp;  lines: +3 -1
A warning is coming:assignment makes integer from pointer without a cast.
Inside display_data() garbage is getting displayed.
Logical error checking…..
—————————-
revision 1.7
date: 2014/01/23 00:22:25;  author: root;  state: Exp;  lines: +1 -0
pthread_join() system call is added to make the main thread to wait for
the other threads to terminate.
—————————-
revision 1.6
date: 2014/01/23 00:19:06;  author: root;  state: Exp;  lines: +1 -1
Logical error fixed.
Issue:Type casting is not done inside the display_data() function.
Program still not displaying the data passed to thread in the output.
Possible reasons:Main thread is terminating first.
—————————-
revision 1.5
date: 2014/01/23 00:17:09;  author: root;  state: Exp;  lines: +6 -2
Definition of the display_data function is added.
Checking….
—————————-
revision 1.4
date: 2014/01/23 00:13:10;  author: root;  state: Exp;  lines: +4 -1
Prototype of the display_data() function and header file:<pthread.h> is included.
—————————-
revision 1.3
date: 2014/01/23 00:06:52;  author: root;  state: Exp;  lines: +11 -1
pthread_create() system call is used to create a thread.
As soon as the thread gets created it will start executing display() function.
—————————-
revision 1.2
date: 2014/01/23 00:01:42;  author: root;  state: Exp;  lines: +3 -0
Taking a number from the user to pass to the thread.
—————————-
revision 1.1
date: 2014/01/22 23:59:59;  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>