KUDU-1177 (part 2): threadpool: signal outside of lock
KUDU-1177 (part 2): threadpool: signal outside of lock

This applies a similar fix as d0c43abc1904245751b8ae7b9462f9e582df4a56
to the ThreadPool queue, preventing the threadpool worker threads
from waking up only to block on the lock held by the submitter thread.

Using the same benchmark as the above-referenced commit, we see a
slight performance improvement:

Before:
 Performance counter stats for './build/latest/tablet_server-stress-test --num_inserts_per_thread=50000' (5 runs):

      40718.505794 task-clock                #    4.426 CPUs utilized            ( +-  0.05% )
         2,094,930 context-switches          #    0.051 M/sec                    ( +-  0.14% )
           522,217 cpu-migrations            #    0.013 M/sec                    ( +-  0.28% )
            39,731 page-faults               #    0.976 K/sec                    ( +-  0.03% )
   125,171,973,696 cycles                    #    3.074 GHz                      ( +-  0.04% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    74,868,376,783 instructions              #    0.60  insns per cycle          ( +-  0.02% )
    14,145,083,589 branches                  #  347.387 M/sec                    ( +-  0.02% )
       277,334,163 branch-misses             #    1.96% of all branches          ( +-  0.19% )

       9.200030318 seconds time elapsed                                          ( +-  0.16% )

After:
 Performance counter stats for './build/latest/tablet_server-stress-test --num_inserts_per_thread=50000' (5 runs):

      39887.039549 task-clock                #    4.418 CPUs utilized            ( +-  0.17% )
         1,964,678 context-switches          #    0.049 M/sec                    ( +-  0.07% )
           506,337 cpu-migrations            #    0.013 M/sec                    ( +-  0.16% )
            39,624 page-faults               #    0.993 K/sec                    ( +-  0.08% )
   122,770,938,916 cycles                    #    3.078 GHz                      ( +-  0.17% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    74,086,710,989 instructions              #    0.60  insns per cycle          ( +-  0.02% )
    13,990,794,711 branches                  #  350.760 M/sec                    ( +-  0.02% )
       270,713,874 branch-misses             #    1.93% of all branches          ( +-  0.27% )

       9.028527748 seconds time elapsed                                          ( +-  0.12% )

Summary:
- ~2% improvement in CPU usage and wall clock
- ~6.2% improvement in context switch count

Tail latencies dropped by a few percent as well:
  /tmp/tpool-before.txt:    "percentile_95": 226,
  /tmp/tpool-before.txt:    "percentile_95": 225,
  /tmp/tpool-before.txt:    "percentile_95": 229,
  /tmp/tpool-before.txt:    "percentile_95": 226,
  /tmp/tpool-before.txt:    "percentile_95": 227,
  /tmp/tpool-fixed.txt:    "percentile_95": 222,
  /tmp/tpool-fixed.txt:    "percentile_95": 221,
  /tmp/tpool-fixed.txt:    "percentile_95": 222,
  /tmp/tpool-fixed.txt:    "percentile_95": 221,
  /tmp/tpool-fixed.txt:    "percentile_95": 221,

Change-Id: I85bf98c2282f9996401fbe93f8ac17ae4fab0a21
Reviewed-on: http://gerrit.cloudera.org:8080/1350
Tested-by: Internal Jenkins
Reviewed-by: David Ribeiro Alves <33ea948168c114d220e0372a903be6ee60f6396e@cloudera.com>

andrwng/kudu,helifu/kudu,InspurUSA/kudu,cloudera/kudu,EvilMcJerkface/kudu,cloudera/kudu,andrwng/kudu,cloudera/kudu,helifu/kudu,InspurUSA/kudu,helifu/kudu,andrwng/kudu,EvilMcJerkface/kudu,helifu/kudu,andrwng/kudu,InspurUSA/kudu,InspurUSA/kudu,cloudera/kudu,EvilMcJerkface/kudu,InspurUSA/kudu,cloudera/kudu,cloudera/kudu,cloudera/kudu,EvilMcJerkface/kudu,andrwng/kudu,EvilMcJerkface/kudu,andrwng/kudu,EvilMcJerkface/kudu,andrwng/kudu,EvilMcJerkface/kudu,helifu/kudu,helifu/kudu,cloudera/kudu,InspurUSA/kudu,InspurUSA/kudu,InspurUSA/kudu,helifu/kudu,andrwng/kudu,cloudera/kudu,InspurUSA/kudu,andrwng/kudu,helifu/kudu,EvilMcJerkface/kudu,helifu/kudu,EvilMcJerkface/kudu