# -*coding: UTF-8 -*-
from multiprocessing import Pool, Process
from time import sleep
def f(x):
    return x*x

def print_name(name):
    sleep(3)
    print 'hello', name


if __name__ == '__main__':

    #création d'un pool de traitement via function
    p = Pool(5)
    print(p.map(f, [1, 2, 3]))

    #création d'un premier processus
    p = Process(target=print_name, args=('bob',))
    p.start()
    p2 = Process(target=print_name, args=('bill',))
    p2.start()
    while p.is_alive() or p2.is_alive():
        print 'attente print'
        sleep(1)