multi-thread I2C synchronization
The best way would be implementing an I²C worker thread that has a fifo holding several transactions. Each transaction is an array of several transfers, each one with a device address (including R/W), the number of bytes to write/read and a pointer to a data buffer. The thread reads such a transaction and issues start (and repeated start) conditions for each transfer, do the transfer, next transfer(s), finally stop condition. That's implementable in about 50 short lines of C code, including the typedefs.