It is very important to note that variables are not shared between threads, all variables are per default thread local. To use shared variables one must use threads::shared.