Skip to content

RM5248

We don't fix problems, we make them worse!

Menu
  • Cross-compile QT for ARM
  • D-Bus Tutorial
  • Debian Packaging Tutorial
Menu

Stupid C++ Threads and Lambdas

Posted on August 21, 2021

For a unit test that I’m writing for some code at the moment, I need to create a thread that doesn’t do anything. Well, the easiest way to do this is to do a lambda function. And since we don’t need to capture anything, and the thread doesn’t need to do anything, I have written the following line of code:

std::thread thr = std::thread( [](){} );

Just look at it in its simplicity. In case you missed it:

[](){}

I actually started laughing after I had written that, it’s just so stupid that it’s funny!

1 thought on “Stupid C++ Threads and Lambdas”

  1. noah says:
    February 1, 2023 at 6:52 am

    I think the same way, LOL

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

©2023 RM5248 | Design: Newspaperly WordPress Theme