I got the answer from below link.
http://www.unet.univie.ac.at/aix/aixprggd/genprogc/writing_reentrant_thread_safe_code.htm#o8Nfj357manu
Do you mean 'will the compiler complain' - no.
'Is it a good idea' - Again, probably not.Reentrant functions should have all of their data passed to them as arguments, and not use global data structures. Semaphores are traffic cops for access to global objects or shared objects.
This sounds like a threads design problem. What are you trying to do?