Making vars shared across threads volatile

Making vars shared across threads volatile