autotest/autotest — pull request #641 by rbbratta (2013-05-03 23:19:13+00:00)
Title: AsyncJob: implement support for stdin as string

AsyncJob did not support filling the stdin pipe with a string input.
Resolve this by creating a new thread function to write stdin_string
in 512 byte chunks to the subprocess stdin PIPE.

Extract the drainer thread to be a protected staticmethod so we can
unittest it.

Refactor the thread functions to eliminate branches and lookups during
the while loop.

Instead of checking for None, check for the actual methods we use.
Only check once if Lock is None, otherwise in the case of None replace
acquire() and lock() with a noop like bool.

Signed-off-by: Ross Brattain