Discuss Threads in c language!! in the C Programming forum on Dev Shed. Threads in c language!! C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Posts: 6,256
Time spent in forums: 2 Months 2 Weeks 5 Days 20 h 36 m 23 sec
Reputation Power: 1985
Threads are not supported by the C standard. Support for threads is platform-dependent; some operating systems support them and some don't. Many compilers provide libraries for accessing operating system support for threads, but some don't.
In order to even begin to answer your question, we must know what operating system you are using. And what compiler. For example, Turbo C 2 offers absolutely no threading support, since it's a 16-bit DOS compiler; MS-DOS did not support threading.
Posts: 7,652
Time spent in forums: 3 Months 6 Days 1 h 35 m 4 sec
Reputation Power: 6083
If you're looking for third-party libraries, I recommend boost threads.
__________________ Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
“Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.”
Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
-Partial Credit: Sun
If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
Ches Koblents
Posts: 6,256
Time spent in forums: 2 Months 2 Weeks 5 Days 20 h 36 m 23 sec
Reputation Power: 1985
Quote:
Originally Posted by bonjovi4u
any one has sample code here for implementing thread in c??
The problem with using Google to find something is that you need to know what it's called. You need to know that both for setting the search words and for recognizing which hits would be useful.
I gave you that. Now you can Google for information on pthreads and for sample code. Now go Google.
Posts: 9
Time spent in forums: 1 h 10 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by dwise1_aol
The problem with using Google to find something is that you need to know what it's called. You need to know that both for setting the search words and for recognizing which hits would be useful.
I gave you that. Now you can Google for information on pthreads and for sample code. Now go Google.
i have gone through google enough found sevral pthread examples but every time i am compiling the code i get the following error...
/tmp/ccSzMvuS.o: In function `main':
thread.c.text+0x80): undefined reference to `pthread_create'
collect2: ld returned 1 exit status
or this
/tmp/ccmrzvzA.o: In function `main':
thread.c.text+0x3d): undefined reference to `pthread_create'
thread.c.text+0x62): undefined reference to `pthread_create'
thread.c.text+0x78): undefined reference to `pthread_join'
thread.c.text+0x8b): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,406
Time spent in forums: 2 Months 10 h 17 m 19 sec
Reputation Power: 4080
That means it can't find your thread library. Stick a -lthread at the end of your gcc command line.
__________________ Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Posts: 1
Time spent in forums: 23 m 52 sec
Reputation Power: 0
How to implement coding in c program to open a URL
New Friends at Dev Shed Forums:
I am very new to c language.
Going through my first class in the topic.
I have built a program that counts down from 10 to 0 at 1 second intervals and at the end I want to open a URL that will display a rocket launch in a web browser.
I am using a Pelles IDE compiler. Have not been able to find simple commands from the internet that this compiler or this program would accept to open URL. Any idea on how can get to work to open a URL? :
Here is my code so far (I just need to implement the portion of coding that would open a URL):