using barrier parametersthis means that the function can be used with different barrier objects depending upon the context an example using the barrier class with set of threads is given belowfrom threading import barrierthread from time import sleep from random import randint def print_it(msgbarrier)print('print_it for:'msgfor in range( )print(msgend=''flush=truesleep( sleep(randint( )print('wait for barrier with:'msgbarrier wait(print('returning from print_it:'msgdef callback()print('callback executing'print('main starting' barrier( callbackt thread(target=print_itargs=(' ' ) thread(target=print_itargs=(' ' ) thread(target=print_itargs=(' ' ) start( start( start(print('main done'the output from this ismain starting print_it fora print_it forb print_it forc abc main done abcacbacbabcacbcabacbacbbac wait for barrier withb wait for barrier witha wait for barrier withc callback executing returning from print_ita returning from print_itb returning from print_itc from this you can see that the print_it(function is run three times concurrentlyall three invocations reach the barrier wait(statement but in different order to that in which they were started once the three have reached this point the callback function is executed before the print_it(function invocations can proceed