Fix multithread issue in localmsg API

Ah, I see. Could you move the queuing logic in the image-processing server implementation then? I'd like to move this createUniqueFunction in the fs library at some other time, so it'd be better if it continued to be generic.