rather than passing a callback, can't this function get the appropriate attribute off the compiler class by loading it by name?  That would make the code more portable between thread pools (where you can pass a callback) and process pools (where you cannot, because you can't pickle functions)  Basically don't pass code as arguments -- make the args to mapped functions pure data.