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(); } }
private static void HandleFree(WriteHandle writeHandle) { if (writeHandle._pins.Count < 1) { return; } foreach (GCHandle current in writeHandle._pins) { current.Free(); } writeHandle._pins.Clear(); }
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)); }