úÎZUÕ7      !"#$%&'()*+,-./0123456 Safe-Inferred<For a bounded deque, pushing may fail if the deque is full. 7Create a new, bounded deque with a specified capacity. <For a bounded deque, pushing may fail if the deque is full. FPushing is not the native operation for the right end, so it requires  that end be a . BPopL is not the native operation for the left end, so it requires  that the left end be a #, but places no other requirements  on the input queue. @Class encompassing the basic queue operations that hold for all A single, 1.5, and double ended modes. We arbitrarily call the  ends "left" and "right") and choose the natural operations to be 1 pushing on the left and popping on the right. <Create a new deque. Most appropriate for unbounded deques. ( If bounded, the size is unspecified. QIs the queue currently empty? Beware that this can be a highly transient state. 3Natural push: push onto the left end of the deque. 2Natural pop: pop from the right end of the deque. (Runtime indication of thread saftey for   (and popL).  (Argument unused.) (Runtime indication of thread saftey for   (and ).  (Argument unused.) ?Work-stealing deques (1.5 ended). Typically the worker pushes C and pops its own queue (left) whereas thieves only pop (right). A concurrent deque. A concurrent queue. 3A traditional single-threaded, single-ended queue. QPop operations may possibly duplicate elements. Hopefully with low probability! 'The queue will not duplicate elements. *The queue can grow as elements are added.  The queue has bounded capacity. 2This end of the queue supports both push and pop. <This end of the queue provides push-only (left) or pop-only ! (right) functionality. Thus a  /  combination ( is what is commonly referred to as a single ended queue , whereas   /  is  a double ended queue,. Heterogeneous combinations are sometimes  colloquially referred to as "1.5 ended queues". <Only one thread at a time may access this end of the queue. Haskell IO threads (Control.Concurrent) may concurrently access ; this end of the queue. Note that this attribute is set + separately for the left and right ends. EA family of Deques implementations. A concrete Deque implementation B is selected based on the (phantom) type parameters, which encode  several choices. EFor example, a work stealing deque is threadsafe only on one end and  supports push/,pop on one end (and pop-only) on the other:  > (Deque NT T D S Grow elt) BNote, however, that the above example is overconstraining in many F situations. It demands an implementation which is NOT threadsafe on B one end and does NOT support push on one end, whereas both these & features would not hurt, if present. FThus when accepting a queue as input to a function you probably never > want to overconstrain by demanding a less-featureful option. For example, rather than (Deque NT D T S Grow elt)  You would probably want: (Deque nt D T s Grow elt) !  !  !      Safe-Inferred!7Stores a size bound (if any) as well as a mutable Seq. !"7#$%&'()*+,89:;< !"#$%&'()*+, !"$(%&*')+,#!"7#$%&'()*+,89:;<None.=How many communicating agents are there? By default one per  thread used by the RTS. /BIt is possible to have imbalanced concurrency where there is more E contention on the producing or consuming side (which corresponds to : settings of this parameter less than or greater than 1). 08This test serially fills up a queue and then drains it. 1This test splits the . threads into producers and ? consumers which all communicate through a SINGLE queue. Each D thread performs its designated operation as fast as possible. The  = argument total+ designates how many total items should be  communicated (irrespective of .). >AThis test uses a separate queue per consumer thread. The queues B are used in a single-writer multiple-reader fashion (mailboxes). ?LThis test uses a number of producer and consumer threads which push and pop 6 elements from random positions in an array of FIFOs. 2IThis creates an HUnit test list to perform all the tests that apply to a B single-ended (threadsafe) queue. It requires thread safety at both ends. @5Tests exclusive to single-ended (threadsafe) queues: ATests that don''t require thread safety at either end. 3Trivial test: push then pop. 4-Trivial test: push left, pop left and right. BLThis test uses a number of producer and consumer threads which push and pop 6 elements from random positions in an array of FIFOs. 5OAggregate tests for work stealing queues. None of these require thread-safety > on the left end. There is some duplication with tests_fifo. 6DThis requires double ended queues that are threadsafe on BOTH ends. C?This is always a crazy and dangerous thing to do -- GHC cannot A deschedule this spinning thread because it does not allocate: D=Debugging flag shared by all accelerate-backend-kit modules. D This is activated by setting the environment variable DEBUG=1..5 E5Print if the debug level is at or above a threshold. F-G./H01>?I2@A34B5J6KLMNCOPDQER -./0123456 0123456-./F-G./H01>?I2@A34B5J6KLMNCOPDQER Safe-InferredS      !"#$%&'(   )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQabstract-deque-0.2Data.Concurrent.Deque.ClassData.Concurrent.Deque.ReferenceData.Concurrent.Deque.Tests-Data.Concurrent.Deque.Reference.DequeInstanceBoundedRtryPushRBoundedL newBoundedQtryPushLPushRpushRPopLtryPopL DequeClassnewQnullQpushLtryPopRleftThreadSaferightThreadSafeWSDeque ConcDeque ConcQueueQueueDSNTTDupSafeGrowBound DoubleEnd SingleEnd Nonthreadsafe ThreadsafeDeque SimpleDequeDQ _is_using_CASnumElems numAgents producerRatiotest_fifo_filldraintest_fifo_OneBottleneck tests_fifo test_ws_triv1 test_ws_triv2 tests_wsqueue tests_allmodify$fBoundedRSimpleDeque$fBoundedLSimpleDeque$fPushRSimpleDeque$fPopLSimpleDeque$fDequeClassSimpleDequeghc-prim GHC.TypesInttest_contention_free_paralleltest_random_array_commtests_fifo_exclusive tests_basictest_random_work_stealing spinPopHarddbgdbgPrinttheEnv forkThread warnUsing expectedSumtests_wsqueue_exclusivemyforkforkWithExceptionsforkJoin spinPopBkoffspinPopNfor_ defaultDbg dbgPrintLn