Thread

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • havanakoda

    Thread

    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

    #2
    Re: Thread

    havanakoda wrote:
    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

    Comment

    • Jack Klein

      #3
      Re: Thread

      On Sun, 16 Mar 2008 09:33:05 -0700 (PDT), havanakoda
      <andreavianello @gmail.comwrote in comp.lang.c:
      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.progr amming.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.l earn.c-c++

      Comment

      • Ulrich Eckhardt

        #4
        Re: Thread

        havanakoda wrote:
        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

        Comment

        • Ian Collins

          #5
          Re: Thread

          havanakoda wrote:
          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.

          Comment

          • Randy Howard

            #6
            Re: Thread

            On Sun, 16 Mar 2008 11:39:06 -0500, jacob navia wrote
            (in article <frjifi$r7h$1@a ioe.org>):
            havanakoda wrote:
            >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.programmin g.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





            Comment

            • jacob navia

              #7
              Re: Thread

              Randy Howard wrote:
              On Sun, 16 Mar 2008 11:39:06 -0500, jacob navia wrote
              (in article <frjifi$r7h$1@a ioe.org>):
              >
              >havanakoda wrote:
              >>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

              Comment

              Working...