Opened 11 years ago

Closed 11 years ago

#3185 enhancement closed duplicate (duplicate)

twisted.python.ThreadPool ought to have a deferToThread() method

Reported by: gfalcon Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:


If you use your own instance of twisted.python.ThreadPool, there is no good way to get a deferred representing a function run in a thread, short of writing your own helper functions.

twisted.python.ThreadPool.dispatchWithCallback() at least does what I need, but doesn't use deferreds and is deprecated.

twisted.internet.threads.deferToThread() is precisely what I need, except that it only works with the global threadpool.

I note that twisted.enterprise.adbapi.ConnectionPool rolls its own _deferToThread() method with the appropriate semantics, as evidence that such a method would be generally useful.

Change History (2)

comment:1 Changed 11 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

This is basically a duplicate of #2845

comment:2 Changed 8 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.