Queue and execute work from scheduler threads on other threads to prevent schedulers from sleeping.
Depend on async_nif.h
Merge remote-tracking branch 'origin/master' into gsb-async-nifs2

Conflicts:
	c_src/wterl.c
	src/riak_kv_wterl_backend.erl
	src/wterl.erl
Rename function to match new API.
Bumping reductions manually will not be supported in future releases of the
BEAM and has dubious value anyway.  Remove that and ignore queue depth for
now.
Ignore a bit more.
An updated Emacs cmode leads to all sorts of whitespace fixes intermixed with
some merge changes.
WIP-- Not Yet Compiling or Functional -- WIP

* No longer expose WT_SESSION into Erlang at all as WT's model is to
maintain one WT_SESSION per-thread and we don't know anything about
threads in Erlang.

* async_nif worker threads don't pull both mutexes on every loop
when processing requests, only one

* async_nif provides a worker_id (int, 0 - MAX_WORKERS) within the
work block scope which we use to find our per-worker WT_SESSIONs

* async_nif maintained a number of globals which I'm moving into
the NIF's priv_data so that on upgrade/reload we have a fighting
chance to "Do the Right Thing(TM)".

* NIF Upgrades/Reloads started to plumb this in.

* Use a khash to manage the cache of URI->WT_CURSORs per WT_SESSION.

* Added start/stop positions into truncate call to allow for truncating
sub-ranges data.

* Lots of other details I'm sure I've forgotten and more left undone.
Search for "TODO:" or try to compile to see what's left, and then
there is a need for a lot more tests given all this new complexity.
WIP-- Compiling, not yet tested/functional -- WIP

Changes required to iron out compiler errors, warnings, etc.  Code now
compiles with clang or gcc.
WIP: Fix minor C89 issue
Use non-cursor ops for get/put/delete because under the covers they
are reusing sessions and cursors in the NIF layer.  Keep two cursors
open for just the house keeping tasks, is_empty and stats.
Opening a connection now involves passing in both a configuration
string for the connection and for any sessions.  Don't convert
configuration proplists into strings (Erlang binaries) until calling
into the NIF layer.
WIP -- tests failing -- WIP
Fixed numerous bugs.  Pushed config_to_bin down to just before
calling the _nif() function, everywhere else config is a proplist.
WIP -- continue to fix tests in wterl
WIP -- more tests passing, plenty left to fix
WIP -- most tests running, a few commented out, sometimes a segv on exit
WIP -- Most tests passing, truncate and drop failing due to EBUSY,
also not sure why there is a segv when exiting but not in gdb.
Unlock mutex before returning error codes.  Alloc/free copies of some
strings allocated on the stack.
WIP -- 41 tests pass, 3 fail = progress!  Right now I have the connection
dtor commented out, otherwise it would SEGV on GC.  Some of the truncate
tests fail (race?) but don't SEGV, so that's not so bad.  Fixed numerous
issues and also removed a mutex and queue of idle worker threads because
it isn't used so why bother with it?
Move the cleanup code into conn_close and remove the need for a dtor
function for resource GC/cleanup.  It's easier.
Reusing closed cursors is bad for your health (SEGV), don't do that.
Also a bit of paranoia, bzero after all enif_alloc calls.