linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* thread programming
@ 2004-04-02 11:52 MuthuKumar
  2004-04-02 12:19 ` Uday K Verma
  0 siblings, 1 reply; 2+ messages in thread
From: MuthuKumar @ 2004-04-02 11:52 UTC (permalink / raw)
  To: linux-c-programming

Hai All.

I have tried the basic thread program as

#include <stdio.h>
#include <pthread.h>
#include <errno.h>

void *fun()
{
        printf("Hai\n");
        pthread_exit((void *)8);
}

main()
{
pthread_t t[10];
int res,ret;
int i=0,loop=10;
for(i=0;i<loop;i++)
{
t[i]=(pthread_t)malloc(sizeof(pthread_t));
res=pthread_create(&t[i],NULL,fun,NULL);
ret=pthread_join(t[i],(void *)res);
free(t[i]);
}
}

Is it a good way of programming. Or any other effective to do this basic
program.

Thanks for the Reply!
--
Regards,
Muthukumar.



---
Status of a mail from <172.16.1.46 | 00-0B-CD-2A-98-69>
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004




^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: thread programming
  2004-04-02 11:52 thread programming MuthuKumar
@ 2004-04-02 12:19 ` Uday K Verma
  0 siblings, 0 replies; 2+ messages in thread
From: Uday K Verma @ 2004-04-02 12:19 UTC (permalink / raw)
  To: 'MuthuKumar', linux-c-programming

I seriously believe you need a C programming book before you delve into
threads. 

Uday K Verma 
//

Hai All.

I have tried the basic thread program as

#include <stdio.h>
#include <pthread.h>
#include <errno.h>

void *fun()
{
        printf("Hai\n");
        pthread_exit((void *)8);
}

main()
{
pthread_t t[10];
int res,ret;
int i=0,loop=10;
for(i=0;i<loop;i++)
{
t[i]=(pthread_t)malloc(sizeof(pthread_t));
res=pthread_create(&t[i],NULL,fun,NULL);
ret=pthread_join(t[i],(void *)res);
free(t[i]);
}
}

Is it a good way of programming. Or any other effective to do this basic
program.

Thanks for the Reply!
--
Regards,
Muthukumar.



---
Status of a mail from <172.16.1.46 | 00-0B-CD-2A-98-69> Checked by AVG
anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004



-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-02 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-02 11:52 thread programming MuthuKumar
2004-04-02 12:19 ` Uday K Verma

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).