This is the threaded atomic add test from glib/tests/atomic.c, redone using qdata instead of an atomic int to store the values.