I'm currently working with a system where the input is event driven but the output needs to be ordered so the first request will be the first response. The reason for this systems design is that the requests work on semi-large datasets and will take a while to process. So it'll take 10 requests and create a thread for each, process the data and then lock at a SendResponse
type function.
What would be the easiest way to go about implementing some queue for the mutex at the SendResponse
function?
My first thought was to make a queue of thread id's; check if the current thread is the front entry in SendResponse
and sleep if it's not. But there's surely a better way?
Aucun commentaire:
Enregistrer un commentaire