As far as I understand your problem you have multithreaded application, where number of threads is more than one. Threads are accessing the same device (IP) and the race condition occurs? If so, and there is no need to have just one device, you can instantiate two (or more) such devices (if it si possible). But you have to instruct each thread to access its device (e.g. using different address space).
-- Research Assistant at Brno University of Technology | CEO at RehiveTech spin-off company