... Overall I think there is an assumption in any API that any callback functions provided in a registration call can immediately be called. Otherwise any API would be in trouble. Can you modify your code to not require the port pointer in its callback functions ?