tests: semaphore: fix empty loop error for XCC

When building with XCC, k_therad_access_grant() expands to
a loop but does nothing if no building for userspace. XCC
does not like this and emits error:

  main.s: Assembler messages:
  main.s:4563: Error: invalid empty loop

So add #ifdef to only enable the loop if userspace is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 file changed