# Is callback function is thread safe?

**URL:** <https://forum.ansible.com/t/is-callback-function-is-thread-safe/33653>\
**Category:** AWX Project\
**Created:** [August 21, 2020, 8:34am UTC](https://forum.ansible.com/t/is-callback-function-is-thread-safe/33653 "2020-08-21T08:34:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nihanth\_Joseph](https://avatars.discourse-cdn.com/v4/letter/n/bcef8e/32.png) [@Nihanth\_Joseph](https://forum.ansible.com/u/Nihanth_Joseph)\
**Post date:** [August 21, 2020, 8:34am UTC](https://forum.ansible.com/t/is-callback-function-is-thread-safe/33653/1 "2020-08-21T08:34:44Z")

</div>

I have written playbooks to manage 100s of machines and i am using callback plugins to capture the output of each task and generate reports at the end. Since I am using forks (eg. 20) do i have to handle each output in thread safe manner?

eg:

class CallbackModule(CallbackBase):  
def **init** (self):  
output =

def v2\_runner\_on\_ok(self, result, \*\*kwargs):  
with self.lock:

# capture output

def v2\_playbook\_on\_stats(self, stats):

# generate report
