I basically have to create a simplified device controller for an OS. I need to create synchronous and asynchronous functions to input/output a word of data to a queue and when the "device" is ready, it is signalled & function returns. The synchronous functions block themselves until the device removes the word from queue & signals function (output) and until request is satisfied (input).
I'm not sure how to handle the synchronous functions where they need to block until request is handled. How can I implement the blocking aspect? Would using a pthread lock do what I need?
Thanks.