def same_host_create(self,constructor2,*args2): class CreateEndpoint(threading.Thread): def __init__(self,threadsafe_queue, same_host_conn_obj,constructor, *args): self.threadsafe_queue = threadsafe_queue self.same_host_conn_obj = same_host_conn_obj self.constructor = constructor self.args = args threading.Thread.__init__(self) self.daemon = True def run(self): endpoint = self.constructor( _waldo_classes,_host_uuid,self.same_host_conn_obj,*self.args) self.threadsafe_queue.put(endpoint) same_host_conn_obj = waldoConnectionObj._WaldoSameHostConnectionObject() q1 = Queue.Queue() ce1 = CreateEndpoint(q1,same_host_conn_obj,constructor,*args) ce1.start() q2 = Queue.Queue() ce2 = CreateEndpoint(q2,same_host_conn_obj,constructor2,*args2) ce2.start() first_endpoint = q1.get() second_endpoint = q2.get() return first_endpoint, second_endpoint