/// <summary> /// filewriting thread's loop /// </summary> void threadproc() { try { while (true) { Object o = threadQ.Take(); if (o is IAsyncResult) { jmdfile.AddVideo(GzipFrameDelegate.EndInvoke((IAsyncResult)o)); } else if (o is short[]) { jmdfile.AddSamples((short[])o); } else { // anything else is assumed to be quit time return; } } } catch (Exception e) { System.Windows.Forms.MessageBox.Show("JMD Worker Thread died:\n\n" + e); return; } }