<commit_before>=begin

    This file is part of the Arachni-RPC EM project and may be subject to
    redistribution and commercial restrictions. Please see the Arachni-RPC EM
    web site for more information on licensing and terms of use.

=end

module Arachni
module RPC

#
# Provides some convenient methods for EventMachine's Reactor.
#
# @author: Tasos "Zapotek" Laskos <<EMAIL>>
#
module EM

module Synchrony

    def run( &block )
        @@root_f = Fiber.new { block.call }.resume
    end

    extend self

end

    #
    # Inits method variables for the Reactor tasks and its Mutex.
    #
    def init
        @@reactor_tasks_mutex ||= Mutex.new
        @@reactor_tasks ||= []
    end

    #
    # Adds a block in the Reactor.
    #
    # @param    [Proc]    &block    block to be included in the Reactor loop
    #
    def add_to_reactor( &block )

        self.init

        # if we're already in the Reactor thread just run the block straight up.
        if ::EM::reactor_thread?
            block.call<commit_msg>removed empty line<commit_after>=begin

    This file is part of the Arachni-RPC EM project and may be subject to
    redistribution and commercial restrictions. Please see the Arachni-RPC EM
    web site for more information on licensing and terms of use.

=end

module Arachni
module RPC

#
# Provides some convenient methods for EventMachine's Reactor.
#
# @author: Tasos "Zapotek" Laskos <<EMAIL>>
#
module EM

module Synchrony

    def run( &block )
        @@root_f = Fiber.new { block.call }.resume
    end

    extend self

end

    #
    # Inits method variables for the Reactor tasks and its Mutex.
    #
    def init
        @@reactor_tasks_mutex ||= Mutex.new
        @@reactor_tasks ||= []
    end

    #
    # Adds a block in the Reactor.
    #
    # @param    [Proc]    &block    block to be included in the Reactor loop
    #
    def add_to_reactor( &block )
        self.init

        # if we're already in the Reactor thread just run the block straight up.
        if ::EM::reactor_thread?
            block.call
{'fraction_non_alphanumeric': 0.07295719844357977, 'fraction_numerical': 0.0, 'mean_word_length': 2.383223684210526, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5252492', 'n_tokens_mistral': 652, 'n_tokens_neox': 627, 'n_words': 241}