* Problem Executing thread.
@ 2004-11-11 12:40 Mukund JB.
2004-11-13 23:12 ` Jon Masters
0 siblings, 1 reply; 2+ messages in thread
From: Mukund JB. @ 2004-11-11 12:40 UTC (permalink / raw)
To: linuxppc-embedded
Hai all,
I have a query regarding the threads in Linux.
I wrote an application using the pthreads where in I was to read & write
asynchronously. The read &* write functions are as follows :
void * read( void * X)
{
int a =3D0;
while(a< 1000)
{
printf("IN read thread %d\n",a);
a++;
}
pthread_exit(0);
}
void * read( void * X)
{
int b =3D0;
while(b< 1000)
{
printf("IN write thread %d\n",b);
b++;
}
pthread_exit(0);
}
The Output I get is just a series of 1000 read thread printf statements
and a series of 1000 write thread printf statements. Its like as
follows:-
IN read thread 0
IN read thread 1
IN read thread 2
IN read thread 3
.......
.......
.......
IN read thread 1000
IN write thread 0
IN write thread 1
IN write thread 2
IN write thread 3
.......
.......
.......
IN write thread 1000
Why is this happening?=20
Why are my threads getting executed one after the other rather than
simultaneously.
Thanks for the help in advance.
Regards,
Mukund jampala
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem Executing thread.
2004-11-11 12:40 Problem Executing thread Mukund JB.
@ 2004-11-13 23:12 ` Jon Masters
0 siblings, 0 replies; 2+ messages in thread
From: Jon Masters @ 2004-11-13 23:12 UTC (permalink / raw)
To: Mukund JB.; +Cc: linuxppc-embedded
On Thu, 11 Nov 2004 18:10:46 +0530, Mukund JB.
<mukundjb@esntechnologies.co.in> wrote:
> I have a query regarding the threads in Linux.
You didn't send all of the code and had hand altered what you posted
since both functions had the same name by the time you posted it to
the list - please resend it all.
Jon.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-13 23:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-11 12:40 Problem Executing thread Mukund JB.
2004-11-13 23:12 ` Jon Masters
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).