Use wrap to give correct name to mainthread wrapped func. Fixes #2027.
Merge pull request #2330 from matham/wrap

Use wrap to give correct name to mainthread wrapped func. Fixes #2027.