jeudi 14 juin 2018

QThreadStorage vs C++11 thread_local

As the title suggests: What are the differences. I know that QThreadStorage existed long before the thread_local keyword, which is propably why it exists in the first place - but the question remains: Is there any significant difference in what they do between those two (except for the extended API of QThreadStorage).

Im am assuming a normal use case of a static variable - as using QThreadStorage as non static is possible, but not recommended to do.

static thread_local int a;
// vs
static QThreadStorage<int> b;

Aucun commentaire:

Enregistrer un commentaire