Thread: C Pthread Help

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    1

    C Pthread Help

    Hi guys I'm newbie. First I am sorry for my bad English.

    Question:
    I'm writing a application in C/Linux use pthread library. I create a thread but main function's freeze(not work) why ? Help me please.

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well without seeing your code, it's hard to say which of the many 1000's of ways you could have messed up applies to you.

    Second, newbies shouldn't be anywhere near threads until you've had 6 months of solid programming experience writing normal single-threaded programs.
    Further, nobody should be writing thread programs unless they've done a thorough analysis and design to make sure threads are the best solution to the problem, and that they have a good design that will work. Just throwing threads at a problem is a recipe for disaster.

    Writing threads is hard; debugging them is harder still.

    When (not if) you wind up with any of the following situations, it will truly mess with your mind.
    Race condition - Wikipedia
    Heisenbug - Wikipedia
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pthread with c
    By rot90 in forum C Programming
    Replies: 1
    Last Post: 01-25-2016, 11:21 AM
  2. About pthread programming
    By sfaxiano in forum C Programming
    Replies: 1
    Last Post: 01-24-2014, 06:10 AM
  3. Replies: 5
    Last Post: 11-06-2013, 04:31 PM
  4. pthread question
    By Overworked_PhD in forum Linux Programming
    Replies: 2
    Last Post: 08-10-2008, 09:52 AM
  5. Using pthread
    By mmondok in forum C Programming
    Replies: 3
    Last Post: 03-17-2003, 12:14 PM

Tags for this Thread