Exemplo n.º 1
0
        private static void UvWriteCallback(IntPtr intPtr, int status)
        {
            WriteHandle writeHandle = GetObjectFromHandel <WriteHandle>(intPtr);
            Action <int, Exception, object> callback = writeHandle._callback;

            writeHandle._callback = null;
            object state = writeHandle._state;

            writeHandle._state = null;
            Exception arg = null;

            if (status < 0)
            {
                writeHandle.LibUv.GetException(status, out arg);
            }
            try
            {
                callback(status, arg, state);
            }
            catch (Exception ex)
            {
                Console.WriteLine("* UvWriteCallback Error:" + Environment.NewLine + ex.ToString());
            }
            finally
            {
                HandleFree(writeHandle);
                writeHandle.Close();
                writeHandle.Dispose();
            }
        }
Exemplo n.º 2
0
 private static void HandleFree(WriteHandle writeHandle)
 {
     if (writeHandle._pins.Count < 1)
     {
         return;
     }
     foreach (GCHandle current in writeHandle._pins)
     {
         current.Free();
     }
     writeHandle._pins.Clear();
 }
Exemplo n.º 3
0
 public unsafe void Write2(WriteHandle writeHandle, UvStreamHandle uvStreamHandle, BufferStruct *bufs, int nbufs, UvStreamHandle sendHandle, Write_Callback cb)
 {
     CheckError(_uv_write2(writeHandle, uvStreamHandle, bufs, nbufs, sendHandle, cb));
 }