Seems we needed an interlocked variable for this after all