<commit_before>class Mutex
{
  constructor() {
    this.queue = [];
    this.pending = false;
  }

  async exclusive(fn) {
    try {
      var release = await this.acquire();
      await fn();
    } finally {
      release();
    }
  }

  async acquire() {
    const release = () => {
      this.pending = this.queue.length > 0;
      let next = this.queue.shift();
      next && next();
    };
<commit_msg>Mutex.exclusive returns whatever it awaits.<commit_after>class Mutex
{
  constructor() {
    this.queue = [];
    this.pending = false;
  }

  async exclusive(fn) {
    try {
      var release = await this.acquire();
      return await fn();
    } finally {
      release();
    }
  }

  async acquire() {
    const release = () => {
      this.pending = this.queue.length > 0;
      let next = this.queue.shift();
      next && next();
    };

{'fraction_non_alphanumeric': 0.15041128084606345, 'fraction_numerical': 0.0023501762632197414, 'mean_word_length': 2.0428571428571427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4184623', 'n_tokens_mistral': 272, 'n_tokens_neox': 267, 'n_words': 63}