<commit_before>extern crate futures;
extern crate futures_channel;
extern crate futures_executor;

use std::thread;

use futures::prelude::*;
use futures_channel::mpsc::*;
use futures_executor::current_thread::run;

#[test]
fn smoke() {
    let (mut sender, receiver) = channel(1);

    let t = thread::spawn(move || {
        run(|c| {
            while let Ok(s) = c.block_on(sender.send(42)) {
                sender = s;
            }
        });
    });

    let _s = run(|c| c.block_on(receiver.take(3).for_each(|_| Ok(())))).unwrap();

    t.join().unwrap()
}<commit_msg>Fix mpsc-close.<commit_after>extern crate futures;
extern crate futures_channel;
extern crate futures_executor;

use std::thread;

use futures::prelude::*;
use futures_channel::mpsc::*;
use futures_executor::current_thread::run;

#[test]
fn smoke() {
    let (mut sender, receiver) = channel(1);

    let t = thread::spawn(move || {
        run(|c| {
            while let Ok(s) = c.block_on(sender.send(42)) {
                sender = s;
            }
        });
    });

    // `receiver` needs to be dropped for `sender` to stop sending and therefore before the join.
    let _ = run(|c| c.block_on(receiver.take(3).for_each(|_| Ok(())))).unwrap();

    t.join().unwrap()
}
{'fraction_non_alphanumeric': 0.16653386454183267, 'fraction_numerical': 0.006374501992031873, 'mean_word_length': 2.9873015873015873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '955511', 'n_tokens_mistral': 445, 'n_tokens_neox': 421, 'n_words': 97}