C++ Threading and Exceptions

Discussion in '3DS - Homebrew Development and Emulators' started by TheToaster, Mar 4, 2016.

  1. TheToaster
    OP

    TheToaster Warrior of the Toast

    Member
    430
    160
    Aug 11, 2015
    United States
    USA
    Hello.

    Is it possible to use the standard C++ multithreading library (such as std::thread and atomic operations) in developing Homebrew? Or can I only use the threading provided by DevKitPro?

    Also, I don't think C++ exceptions work. But can I use the containers, algorithms, and operations from the standard library? I don't know if these would work because they use C++ exceptions internally for error handling.
     
  2. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,882
    Dec 6, 2013
    United States
    STL containers (and most things) work without exceptions. I use them all the time. You can even use exceptions and RTTI, I've used them a little, just make sure you're not compiling with -fno-exceptions flag (or without -rno-rtti if you want that) which is the devkitarm default.
     
  3. TheToaster
    OP

    TheToaster Warrior of the Toast

    Member
    430
    160
    Aug 11, 2015
    United States
    USA
    But won't RTTI and Exceptions cause overhead? Or will it not?

    And also is multithreading library supported for Homebrew?
     
    Last edited by TheToaster, Mar 4, 2016
  4. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,882
    Dec 6, 2013
    United States
    Yeah a bit, and increase filesize, I wouldn't use them if you don't need them. But STL containers, io streams, and algorithm/functional stuff works. I'm pretty sure standard threading or atomic operations don't work, as least not as expected, but I haven't tried, ctrulib has simple threading functions.
     
    DesuIsSparta and TheToaster like this.