hi all,

i need to know how to create a thread using pthread_create()?

i have never used pthread in c. am i supposed to used function pointer? how to pass arguments in thread function?

i need to know everything about pthread_create().

and yes i am using turbo c++ compiler and including the header file pthread.h , but i am getting error and it is not getting included.

please help. i need to finish my assignment on multithreading.

Drew.

Recommended Answers

Your compiler does not support threads. You will have to use a modern compiler such as Code::Blocks or VC++ 2008 Express, both are free for the downloading.

Jump to Post

It is more than just to get the pthread_create() syntax right. How about taking some time and going through

Jump to Post

drewangel : i am using turbo c++ compiler and including the header file pthread.h , but i am getting error and it is not getting included

AncientDragon : Your compiler does not support threads. You will have to use a modern compiler '

drewangel : thanks for …

Jump to Post

All 9 Replies

Your compiler does not support threads. You will have to use a modern compiler such as Code::Blocks or VC++ 2008 Express, both are free for the downloading.

commented: Yes +19

thanks for your reply.

but i want to know the synatx for pthreads. are we supposed to use pointer to functions in that?

commented: seriously, you people need to quit using that piece of crap compiler. -1

thanks. i really need to go through some tutorial. can you suggest me a good book on pthreads for c?

commented: You're verging on sounding like a troll with your gimme gimme gimme refrain -4

Check out this tutorial.

I have no idea about any books on the subject.

However, several books have been listed in the reference section of the given tutorial

drewangel : i am using turbo c++ compiler and including the header file pthread.h , but i am getting error and it is not getting included

AncientDragon : Your compiler does not support threads. You will have to use a modern compiler '

drewangel : thanks for your reply. but i want to know the synatx for pthreads. are we supposed to use pointer to functions in that?

my goodness. Reading comprehension, much?

Turbo C does not support multithreading. you will not get a POSIX thread library to work. What part of this are you not able to understand?

.

But can we add thread.h header file and library to our compiler like Turbo C++ or dev C++ instead using of advance one??

Dev-C++ probably because that is a 32-bit compiler, Turbo C++ no because its only a 16-bit compiler and therefore can not access any of MS-Windows operating system.

I want to make a hoe joke so very badly...

So... nobody brought this up, but libPThread is PRIMARILY a Linux library being "POSIX Threads."
There is a Windows implementation available and can be installed as part of MinGW using it's Get command (i.e. mingw-get, the command line apt-get substitute).

References:
http://en.wikipedia.org/wiki/POSIX_Threads
http://sourceware.org/pthreads-win32/
http://mingw.org

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.