C thread functions?

This is a discussion on C thread functions? within the C Programming forums, part of the General Programming Boards category; Hi I wanna ask some question about thread,... I already understand about thread, mutex and event in Windows (using WinAPI)... ...

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    C thread functions?

    Hi I wanna ask some question about thread,...

    I already understand about thread, mutex and event in Windows (using WinAPI)...
    But I think there is another term in threads called 'semaphore', what is it by the way?

    Is there portable version of mutex and events functions in C? Only found _beginthread and _beginthreadex in process.h...

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The C99 (or earlier) standard doesn't have any support for multithreading. There are portable(ish) libraries that layer on top of native functions, so that you can write code that is portable between Windows and for example Linux. I believe boost (C++) has a good threading library for example. Not sure if there is a pure C library. Someone else may have a suggestion.

    It is also, of course, possible to write your own thin layer to hide the actual system functions - you may want to study your target systems different implementations, and find a way to make a subset of all of them.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    pthreads is supposed to be pretty good.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And there is a pthreads for win32: http://sourceware.org/pthreads-win32/

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-17-2008, 01:00 PM
  2. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 02:17 PM
  3. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 04:55 PM
  4. Replies: 12
    Last Post: 05-17-2003, 06:58 AM
  5. Multi-Thread Programming
    By drdroid in forum C++ Programming
    Replies: 6
    Last Post: 04-04-2002, 02:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21