Message handling in a seperate thread

I’m attempting to run SDL message polling in a seperate thread, so that i can time-stamp the events and pass the usefull ones to my own queue, which is then accessed by the main engine loop. I’ve been trying for a while and can’t find where I’m going wrong. Does anyone have an example of some code to do this, or know where I can find one?

Thanks, Andy