copying over queue-api-redo branch from my 2012 repo

This commit is not cleanly separated from the next one where I got
everything to compile again (and possibly even further on from there).
14 files changed