/// <summary> /// Adds a timeout to a previously prepared linked item to the Submission Queue without it being submitted. /// The actual submission can be deferred to avoid unnecessary memory barriers. /// </summary> /// <param name="ts">The amount of time after which the timeout should trigger</param> /// <param name="timeoutOptions">Options on how <paramref name="ts"/> is interpreted</param> /// <param name="userData">User data that will be returned with the respective <see cref="Completion"/></param> /// <param name="options">Options for the handling of the prepared Submission Queue Entry</param> /// <exception cref="SubmissionQueueFullException">If no more free space in the Submission Queue is available</exception> public void PrepareLinkTimeout(timespec *ts, TimeoutOptions timeoutOptions, ulong userData = 0, SubmissionOption options = SubmissionOption.None) { if (!TryPrepareLinkTimeout(ts, timeoutOptions, userData, options)) { ThrowSubmissionQueueFullException(); } }
/// <summary> /// Adds a timeout to the Submission Queue without it being submitted. /// The actual submission can be deferred to avoid unnecessary memory barriers. /// </summary> /// <param name="ts">The amount of time after which the timeout should trigger if less than <paramref name="count"/> submissions completed.</param> /// <param name="count">The amount of completed submissions after which the timeout should trigger</param> /// <param name="timeoutOptions">Options on how <paramref name="ts"/> is interpreted</param> /// <param name="userData">User data that will be returned with the respective <see cref="Completion"/></param> /// <param name="options">Options for the handling of the prepared Submission Queue Entry</param> /// <exception cref="SubmissionQueueFullException">If no more free space in the Submission Queue is available</exception> public void PrepareTimeout(timespec *ts, uint count = 1, TimeoutOptions timeoutOptions = TimeoutOptions.Relative, ulong userData = 0, SubmissionOption options = SubmissionOption.None) { if (!TryPrepareTimeout(ts, count, timeoutOptions, userData, options)) { ThrowSubmissionQueueFullException(); } }
public static Task <int> Run(TimeoutOptions opts) { if (string.IsNullOrWhiteSpace(opts.ExampleKey) || opts.ExampleKey.Equals("simple", StringComparison.OrdinalIgnoreCase)) { return(new SimpleTimeoutExample().RunExample()); } Console.WriteLine("Timeout example stub"); return(Task.FromResult(0)); }
public SocketNetworkEndpoint(Socket socket, TimeoutOptions timeoutOptions) { this.timeoutOptions = timeoutOptions ?? throw new ArgumentNullException(nameof(timeoutOptions)); connection = socket ?? throw new ArgumentNullException(nameof(socket)); UnboundedChannelOptions channelOptions = new() { AllowSynchronousContinuations = true, SingleReader = true, SingleWriter = true, }; outgoing = Channel.CreateUnbounded <NetworkChunk>(channelOptions); incoming = Channel.CreateUnbounded <NetworkChunk>(channelOptions); }
/// <summary> /// Prepares this Submission Queue Entry as a timeout to a previously prepared linked item. /// </summary> /// <param name="ts">The amount of time after which the timeout should trigger</param> /// <param name="timeoutOptions">Options on how <paramref name="ts"/> is interpreted</param> /// <param name="userData">User data that will be returned with the respective <see cref="Completion"/></param> /// <param name="options">Options for the handling of the prepared Submission Queue Entry</param> /// <param name="personality">The personality to impersonate for this submission</param> public void PrepareLinkTimeout(timespec *ts, TimeoutOptions timeoutOptions = TimeoutOptions.Relative, ulong userData = 0, SubmissionOption options = SubmissionOption.None, ushort personality = 0) { var sqe = _sqe; unchecked { sqe->opcode = IORING_OP_LINK_TIMEOUT; sqe->flags = (byte)options; sqe->fd = -1; sqe->addr = (ulong)ts; sqe->len = 1; sqe->timeout_flags = (uint)timeoutOptions; sqe->user_data = userData; sqe->personality = personality; } }
public TimerClient(Func <string, Container> containerFactory, IOptions <TimeoutOptions> timeout) { _containerFactory = containerFactory; _timeout = timeout.Value; }
/// <summary> /// Attempts to add a timeout to a previously prepared linked item to the Submission Queue without it being submitted. /// The actual submission can be deferred to avoid unnecessary memory barriers. /// </summary> /// <param name="ts">The amount of time after which the timeout should trigger</param> /// <param name="timeoutOptions">Options on how <paramref name="ts"/> is interpreted</param> /// <param name="userData">User data that will be returned with the respective <see cref="Completion"/></param> /// <param name="options">Options for the handling of the prepared Submission Queue Entry</param> /// <returns><code>false</code> if the submission queue is full. <code>true</code> otherwise.</returns> public bool TryPrepareLinkTimeout(timespec *ts, TimeoutOptions timeoutOptions = TimeoutOptions.Relative, ulong userData = 0, SubmissionOption options = SubmissionOption.None) => TryPrepareReadWrite(IORING_OP_LINK_TIMEOUT, -1, ts, 1, 0, (int)timeoutOptions, userData, options);