writeVariable now supports threads