Thread safe task passing to Trema

Added support for thread safe passing of ruby blocks for execution in the Trema thread context.