Connecting Tech Pros Worldwide Forums | Help | Site Map

Thread

havanakoda
Guest
 
Posts: n/a
#1: Mar 16 '08
Hi, sorry for my simple question... but i'm new with the C
programming.
Can I consider the main () as a thread?
Thanks

jacob navia
Guest
 
Posts: n/a
#2: Mar 16 '08

re: Thread


havanakoda wrote:
Quote:
Hi, sorry for my simple question... but i'm new with the C
programming.
Can I consider the main () as a thread?
Thanks
Yes, normally, when threads are supported by the OS, main() runs
in its own thread.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jack Klein
Guest
 
Posts: n/a
#3: Mar 16 '08

re: Thread


On Sun, 16 Mar 2008 09:33:05 -0700 (PDT), havanakoda
<andreavianello@gmail.comwrote in comp.lang.c:
Quote:
Hi, sorry for my simple question... but i'm new with the C
programming.
Can I consider the main () as a thread?
Thanks
main() is the function at which a C program begins execution, after
implementation-specific operations that are specific to the compiler
and environment.

It has nothing at all to do with threads. Threads are not defined or
supported by the C language. Anything to with threads is an extension
supported by a specific operating system and compiler combination.

For information about threads, you need to ask in a group that
supports your particular operating system/compiler combination, or
perhaps a group like news:comp.programming.threads.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Ulrich Eckhardt
Guest
 
Posts: n/a
#4: Mar 16 '08

re: Thread


havanakoda wrote:
Quote:
Hi, sorry for my simple question... but i'm new with the C
programming.
Can I consider the main () as a thread?
Well, others already mentioned that C is ignorant of threads, so this
question can't be answered from the C standard point of view.

Other than that, main() is not a thread but a function. The function main()
is the entry point of the first thread of a process.

Uli

Ian Collins
Guest
 
Posts: n/a
#5: Mar 16 '08

re: Thread


havanakoda wrote:
Quote:
Hi, sorry for my simple question... but i'm new with the C
programming.
Can I consider the main () as a thread?
In a hosted environment that supports threads, typically yes. But that's
purely platform specific.

--
Ian Collins.
Randy Howard
Guest
 
Posts: n/a
#6: Mar 17 '08

re: Thread


On Sun, 16 Mar 2008 11:39:06 -0500, jacob navia wrote
(in article <frjifi$r7h$1@aioe.org>):
Quote:
havanakoda wrote:
Quote:
>Hi, sorry for my simple question... but i'm new with the C
>programming.
>Can I consider the main () as a thread?
>Thanks
>
Yes, normally, when threads are supported by the OS, main() runs
in its own thread.
This is certainly true with Posix threads, but I'm an not sure if it is
true of all thread models.

Either way, comp.programming.threads is probably a good place to ask
such questions, as standard C doesn't include any threading model.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





jacob navia
Guest
 
Posts: n/a
#7: Mar 17 '08

re: Thread


Randy Howard wrote:
Quote:
On Sun, 16 Mar 2008 11:39:06 -0500, jacob navia wrote
(in article <frjifi$r7h$1@aioe.org>):
>
Quote:
>havanakoda wrote:
Quote:
>>Hi, sorry for my simple question... but i'm new with the C
>>programming.
>>Can I consider the main () as a thread?
>>Thanks
>Yes, normally, when threads are supported by the OS, main() runs
>in its own thread.
>
This is certainly true with Posix threads, but I'm an not sure if it is
true of all thread models.
>
This is certainly true under windows too.




--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Closed Thread