use atomic_ calls on FreeBSD