1)Adding: An implementation of thread safe function