Thread-Safety
Is it safe to write data to a device from multiple threads at the same time?
It isn't - and from a cursory glance the underlying APIs are mostly not thread-safe either.
I think that the best course of action is to serialize things in your software by using its event loop mechanism if any - by using https://github.com/max0x7ba/atomic_queue or https://github.com/cameron314/concurrentqueue it should be doable without any locks and with pretty good performance
here's a very simple and largely improvable example of how to do it, for reference: https://github.com/jcelerier/libremidi/blob/master/tests/multithread_midiout.cpp
see https://github.com/jcelerier/libremidi/blob/87a16babd048ba20c0bbff9e8c8d48d7afc965ab/examples%2Fmultithread_midiout.cpp - I'm tempted to close and leave as this as I really think this synchronization is better done outside of the library rather than inside