IronRuby.Builtins.RubyIOOps.GetWaitHandles C# (CSharp) Method

GetWaitHandles() private static method

private static GetWaitHandles ( RubyContext context, RubyArray read, RubyArray write, RubyArray error ) : System.Threading.WaitHandle[]
context RubyContext
read RubyArray
write RubyArray
error RubyArray
return System.Threading.WaitHandle[]
        private static WaitHandle/*!*/[]/*!*/ GetWaitHandles(RubyContext/*!*/ context, RubyArray read, RubyArray write, RubyArray error) {
            WaitHandle[] handles = new WaitHandle[
                (read != null ? read.Count : 0) +
                (write != null ? write.Count : 0) +
                (error != null ? error.Count : 0)
            ];

            int i = 0;
            if (read != null) {
                foreach (object obj in read) {
                    handles[i++] = ToIo(context, obj).CreateReadWaitHandle();
                }
            }

            if (write != null) {
                foreach (object obj in write) {
                    handles[i++] = ToIo(context, obj).CreateWriteWaitHandle();
                }
            }

            if (error != null) {
                foreach (object obj in error) {
                    handles[i++] = ToIo(context, obj).CreateErrorWaitHandle();
                }
            }

            return handles;
        }