def set_context(module_name='thread'):
    '''
    This function initializes the context of execution deciding which
    type of threads are being used: classic python threads or green
    threads, provided by Gevent.

    This should be called first of all in every execution, otherwise,
    the library would not work.

    The default module is 'thread'.

    :param str. module_name: Name of the module you want to use
        ('thread' or 'green_thread').
    '''
    global core_type
    if core_type is None and module_name in available_types:
        core_type = module_name
        util.core_type = core_type
        global actor
        actor = __import__('pyactor.' + module_name + '.actor', globals(),
                           locals(), ['Actor', 'ActorRef'], -1)
        global intervals
        intervals = __import__('pyactor.' + module_name + '.intervals',
                               globals(), locals(),
                               ['interval_host', 'sleep', 'later'], -1)
        global parallels
        parallels = __import__('pyactor.' + module_name + '.parallels',
                               globals(), locals(),
                               ['ActorParallel'], -1)
        global future
        future = __import__('pyactor.' + module_name + '.future',
                            globals(), locals(), ['FutureManager'], -1)
        set_actor(module_name)
        global rpcactor
        rpcactor = __import__('pyactor.' + module_name + '.rpcactor',
                              globals(), locals(), ['RPCDispatcher'], -1)
        global signal
        if module_name == 'green_thread':
            signal = __import__('gevent', ['signal'])
        else:
            signal = __import__('signal', ['signal'])
    else:
        raise Exception('Bad core type.')