# Is there a way to call rendering in other threads in vtk?

**URL:** https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088
**Category:** Support
**Tags:** code
**Created:** [March 29, 2023, 1:06pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088 "2023-03-29T13:06:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)
#### Post date: [March 29, 2023, 1:06pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088/1 "2023-03-29T13:06:19Z")

</div>

Similar to the signal and slot mechanism in qt, you can put functions in other threads into the event loop

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [March 30, 2023, 11:00pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088/2 "2023-03-30T23:00:58Z")

</div>

Hello,

I experienced crashes when I accidentally called rendering from a thread different from the thread where the VTK objects resided. However, it is possible to avoid it by keeping track of the thread id. Well, without further details on what you’re attempting or code it’s hard to tell for sure.

best,

PC

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [March 31, 2023, 11:43am UTC](https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088/3 "2023-03-31T11:43:41Z")

</div>

The slot is executed in the same thread of the signal, so you likely need some other inter-thread commmunication mechanism to safely trigger rendering from multiple threads. One example is the classic producer-consumer model. Take a look here ([multithreading - Inter thread communication in C++ - Stack Overflow](https://stackoverflow.com/questions/48112280/inter-thread-communication-in-c)) to have some ideas.

---

<div class="post-metadata">

### Author: ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)
#### Post date: [March 31, 2023, 1:44pm UTC](https://discourse.vtk.org/t/is-there-a-way-to-call-rendering-in-other-threads-in-vtk/11088/4 "2023-03-31T13:44:59Z")

</div>

thank very much ，I temporarily completed my requirements through semaphores, locks, and timers.
