void OnDisable()
{
//shut down the thread
if(myThread!=null){
keepLooping = false;
Thread.Sleep(5);
myThread.Join();
myThread = null;
}
//shut down the pipeline
if(myPipe != null){
myPipe.Dispose();
myPipe = null;
}
}