What are the rules that function should pass in order to be used in RTOS
your best bet here is to follow the idom "move fast and break things".  Unless you project is a nuclear reactor core I suggest you try and see what works and what doesn't, if you have mentors around ask them for help if you get stuck and are unable to figure it out.

In general an RTOS will provide ways of sharing data between tasks using mailboxes and locks.  The over thing is in a flat memory model without an MMU certain library functions will have re-entrant versions that should be used.  For example strtok uses storage to store the current location in the string, if two threads are using strtok then confusion may arise between successive calls.  In this cas strtok_r should be used.

This paper on C/C++ Thread Safety Analysis is a good read.