@@ -14,7 +14,7 @@ use futures::executor::ThreadPool;
14
14
#[ cfg( feature = "for_futures" ) ]
15
15
use futures:: stream:: Stream ;
16
16
#[ cfg( feature = "for_futures" ) ]
17
- use std:: collections:: VecDeque ;
17
+ use std:: collections:: LinkedList ;
18
18
#[ cfg( feature = "for_futures" ) ]
19
19
use std:: mem;
20
20
#[ cfg( feature = "for_futures" ) ]
@@ -30,9 +30,6 @@ use std::task::{Context, Poll, Waker};
30
30
// pub trait FnMutReceiveThreadSafe<X>: FnMut(Arc<X>) + Send + Sync + 'static {}
31
31
// pub trait FnMutReturnThreadSafe<X>: FnMut() -> X + Send + Sync + 'static {}
32
32
33
- #[ cfg( feature = "for_futures" ) ]
34
- static DEFAULT_STREAM_CACHED_CAPACITY_BLOCK_SIZE : usize = 10 ;
35
-
36
33
#[ cfg( feature = "for_futures" ) ]
37
34
#[ derive( Clone ) ]
38
35
pub struct SharedThreadPoolReader {
@@ -255,9 +252,7 @@ pub struct SubscriptionFunc<T> {
255
252
pub receiver : RawReceiver < T > ,
256
253
257
254
#[ cfg( feature = "for_futures" ) ]
258
- cached : Option < Arc < Mutex < VecDeque < Arc < T > > > > > ,
259
- #[ cfg( feature = "for_futures" ) ]
260
- cached_capacity_block_size : usize ,
255
+ cached : Option < Arc < Mutex < LinkedList < Arc < T > > > > > ,
261
256
#[ cfg( feature = "for_futures" ) ]
262
257
alive : Option < Arc < Mutex < AtomicBool > > > ,
263
258
#[ cfg( feature = "for_futures" ) ]
@@ -277,8 +272,6 @@ impl<T> SubscriptionFunc<T> {
277
272
#[ cfg( feature = "for_futures" ) ]
278
273
cached : None ,
279
274
#[ cfg( feature = "for_futures" ) ]
280
- cached_capacity_block_size : DEFAULT_STREAM_CACHED_CAPACITY_BLOCK_SIZE ,
281
- #[ cfg( feature = "for_futures" ) ]
282
275
alive : None ,
283
276
#[ cfg( feature = "for_futures" ) ]
284
277
waker : Arc :: new ( Mutex :: new ( None ) ) ,
@@ -298,8 +291,6 @@ impl<T> Clone for SubscriptionFunc<T> {
298
291
#[ cfg( feature = "for_futures" ) ]
299
292
cached : self . cached . clone ( ) ,
300
293
#[ cfg( feature = "for_futures" ) ]
301
- cached_capacity_block_size : self . cached_capacity_block_size ,
302
- #[ cfg( feature = "for_futures" ) ]
303
294
alive : self . alive . clone ( ) ,
304
295
#[ cfg( feature = "for_futures" ) ]
305
296
waker : self . waker . clone ( ) ,
@@ -309,13 +300,6 @@ impl<T> Clone for SubscriptionFunc<T> {
309
300
310
301
#[ cfg( feature = "for_futures" ) ]
311
302
impl < T > SubscriptionFunc < T > {
312
- #[ cfg( feature = "for_futures" ) ]
313
- pub fn set_stream_cached_capacity_block_size ( & mut self , size : usize ) {
314
- if size > 0 {
315
- self . cached_capacity_block_size = size;
316
- }
317
- }
318
-
319
303
pub fn close_stream ( & mut self ) {
320
304
if let Some ( alive) = & self . alive {
321
305
{
@@ -361,9 +345,7 @@ where
361
345
}
362
346
363
347
if self . cached . is_none ( ) {
364
- self . cached = Some ( Arc :: new ( Mutex :: new ( VecDeque :: with_capacity (
365
- self . cached_capacity_block_size ,
366
- ) ) ) ) ;
348
+ self . cached = Some ( Arc :: new ( Mutex :: new ( LinkedList :: new ( ) ) ) ) ;
367
349
}
368
350
}
369
351
@@ -398,7 +380,6 @@ impl<T: Send + Sync + 'static> Subscription<T> for SubscriptionFunc<T> {
398
380
if alive {
399
381
{
400
382
let mut cached = cached. lock ( ) . unwrap ( ) ;
401
- cached. reserve_exact ( self . cached_capacity_block_size ) ;
402
383
cached. push_back ( x. clone ( ) )
403
384
} ;
404
385
{
0 commit comments