MinGW thread-safe runtime libraries

This is a discussion on MinGW thread-safe runtime libraries within the C++ Programming forums, part of the General Programming Boards category; I've been using boost::thread successfuly for some time now. Occasionally I run into trouble with mutexes and condition variables but ...

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581

    MinGW thread-safe runtime libraries

    I've been using boost::thread successfuly for some time now. Occasionally I run into trouble with mutexes and condition variables but nothing worth posting here since I eventually have found the solution. However, there is one advice I have not been following and it is starting to worry me.

    I'm advised to use thread-safe runtime libraries in my code. That is fine for the other boost libraries since I built those. However, I simply don't know if the standard libraries that ship with MinGW are thread-safe. There are times where I lock resources defined in these libraries (most especially std::cout and std::cin).

    My knowledge of threads is limited. Does MinGW ship with thread-safe standard libraries? Are these located anywhere in particular? Currently this is the order of includes I have defined for MinGW standard libraries:

    Code:
    C:\MinGW\lib\gcc\mingw32\3.4.5\include
    C:\MinGW\include\c++\3.4.5\backward
    C:\MinGW\include\c++\3.4.5\mingw32
    C:\MinGW\include\c++\3.4.5
    C:\MinGW\include
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    Visual Studio uses a command line option to determine if it should use the single threaded or multi threaded libraries. Perhaps MinGW has a similar option?

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>Perhaps MinGW has a similar option?<<

    -mthreads
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Excellent. Thanks.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thread safe double linked list
    By ShwangShwing in forum C Programming
    Replies: 7
    Last Post: 06-02-2009, 11:55 AM
  2. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 10:27 PM
  3. Multithreading
    By Cela in forum Windows Programming
    Replies: 13
    Last Post: 01-15-2003, 03:02 PM
  4. Your Best thread and your most stupid thread ??
    By jawwadalam in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 01-03-2003, 07:41 PM
  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