Thread: C threads

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    11

    Unhappy C threads

    I was trying to implement threads in my C code and this is the first time I did this I used

    /*mod edit: Dead links removed. Please post your own code, not links, especially ones which lead nowhere ~ kenfitlike*/

    as reference

    but when I compile I get the error

    :/home/shahan/engine_driver.c:43: undefined reference to `pthread_detach'
    collect2: ld returned 1 exit status
    make: *** [engine] Error 1

    I will include the code where I create the thread

    can some one help me on this

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Without looking at your code, I would say you are missing a library in your linker command line arguments.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    11

    C threads

    oh ya I found it. Thsnk you.......\

    though I have a another question

    if the thread exits with 'exit(1)' does this make the parent thread exit too....??

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    From http://www.cplusplus.com/ref/cstdlib/exit.html:
    Terminate calling process.
    So it would terminate other threads, too.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  2. Yet another n00b in pthreads ...
    By dimis in forum C++ Programming
    Replies: 14
    Last Post: 04-07-2008, 12:43 AM
  3. Classes and Threads
    By Halloko in forum Windows Programming
    Replies: 9
    Last Post: 10-23-2005, 05:27 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM