api: mark api_trace_command_fn thread-safe