kandersen82 commented on code in PR #109:
URL: https://github.com/apache/pulsar-dotpulsar/pull/109#discussion_r1018334924


##########
src/DotPulsar/Internal/AsyncQueueWithCursor.cs:
##########
@@ -0,0 +1,251 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace DotPulsar.Internal;
+
+using Exceptions;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class AsyncQueueWithCursor<T> : IAsyncDisposable
+{
+    private readonly AsyncLock _pendingLock;
+    private readonly SemaphoreSlim _cursorSemaphore;
+    private readonly LinkedList<T> _queue;
+    private readonly IList<TaskCompletionSource<object>> _queueEmptyTcs;
+    private readonly uint _maxItems;
+    private IDisposable? _pendingLockGrant;
+    private LinkedListNode<T>? _currentNode;
+    private TaskCompletionSource<LinkedListNode<T>>? _cursorNextItemTcs;
+    private int _isDisposed;
+
+    public AsyncQueueWithCursor(uint maxItems)
+    {
+        _pendingLock = new AsyncLock();
+        _cursorSemaphore = new SemaphoreSlim(1, 1);
+        // TODO: Figure out if we can use 
https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskcompletionsource?view=net-6.0

Review Comment:
   I think the answer is no. We could use compiler flags to differentiate 
between target frameworks, but I don't think it is worth the effort.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to