public void Start ()
{
lock (stateLock) {
if (started)
return;
conn = kqueue ();
if (conn == -1)
throw new IOException (String.Format (
"kqueue() error at init, error code = '{0}'", Marshal.GetLastWin32Error ()));
thread = new Thread (() => DoMonitor ());
thread.IsBackground = true;
thread.Start ();
startedEvent.WaitOne ();
if (exc != null) {
thread.Join ();
CleanUp ();
throw exc;
}
started = true;
}
}