'hal_exit()' must be called before a HAL component exits, to free resources associated with the component. 'comp_id' is the ID of the component as returned from its initial call to 'hal_init()'. 'hal_exit()' will remove the component's realtime functions (if any) from realtime threads. It also removes all pins and parameters exported by the component. If the component created any threads, when it exits all threads will be stopped, and the ones it created will be deleted. It is assumed that the system will no longer function correctly after a component is removed, but this cleanup will prevent crashes when the component's code and data is unmapped. 'hal_exit()' calls 'rtapi_exit()', so any rtapi reaources allocated should be discarded before calling hal_exit(), and rtapi functios should not be called afterwards. On success, hal_exit() returns 0, on failure it returns a negative error code.