Re-apply PyTorch pthreadpool changes
Summary:
This re-applies D21232894 (https://github.com/pytorch/pytorch/commit/b9d3869df357038f798eef579fe1c69cf246887d) and D22162524, plus updates jni_deps in a few places
to avoid breaking host JNI tests.
Test Plan: `buck test @//fbandroid/mode/server //fbandroid/instrumentation_tests/com/facebook/caffe2:host-test`
Reviewed By: xcheng16
Differential Revision: D22199952
fbshipit-source-id: df13eef39c01738637ae8cf7f581d6ccc88d37d5