Enables the passing of user data for callback functions associated with init thread events.
Reference to #2826
Once you are okay with this implementation, I will implement the same for exit thread events, pushing to this branch (so don't merge as of yet?).
I would also like to enquire what is the best way to have tests for this functionality.