Use our thread abstraction layer

Change-Id: I5d52d55ea603d8e53c9b39a94fa3029cdad50748
Reviewed-on: http://review.couchbase.org/30013
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
Use our own mutex abstraction

Change-Id: I12faa0016977e1d5b08cdd05f509aebf71a5bbb8
Reviewed-on: http://review.couchbase.org/30014
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
Use our own condition variable impl

Change-Id: Iad2ce85335fa9d5737fc39282e7429e6bb94c441
Reviewed-on: http://review.couchbase.org/30015
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-9469: include cstring to get std::memcpy

Change-Id: I88d0cc8ce3ddcd1ce245a0e095d5d1043a3c08a3
Reviewed-on: http://review.couchbase.org/30060
Tested-by: Volker Mische <volker.mische@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Refactor newProducer() functions to match passed params

Change-Id: Ia5b4828a969ec204469ad03ae25caad2adb8d33c
Reviewed-on: http://review.couchbase.org/30027
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
call cb_thread_self instead of pthread_self

Change-Id: I2509b9710b0caa0324ec39a18cf82cd8cb1751b8
Reviewed-on: http://review.couchbase.org/30092
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MB-9124: Don't let CheckpointManager move cursors internally

When removing unreference checkpoints and when adding a new
checkpoint the CheckpointManager attempts to move cursors if they
are at the end of the open checkpoint. This case should be rare
should not make much difference in terms of performance. The
removing checkpoint cursors case would have a potential to make a
difference, but it appears that the current code will not actually
do anything since it doesn't take into account the fact that there
is a checkpoint end message that was recently inserted into the
checkpoint. As a result the cursors will never move to the new
open checkpoint. The other place we do this is when adding a new
checkpoint and in that case we only try to move the persistence
cursor. I don't see a benefit here since we will not be removing
any checkpoints at that time and we can just wait for the
persistence cursor to grab the items.

This change will also simplify tracking which items have been
persisted because we will only have one place in the code that can
actually move the cursors forward and that will only happen when
someone grabs items from the checkpoints.

The new UPR changes to the CheckpointManager will also render this
optimization obsolete because we will not allow cursors to be in
open checkpoints.

Change-Id: I1137997a81ee502857fc0517b29cabfe1a1a92c9