Meaning of Tree.sleep() #656
-
My question is why do we need to add a sleep interval in the tick cycle of the tree? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Answer from @facontidavide : Since the concept of ticking a tree is basically "polling", we don't want to consume 100% of the cpu, bombarding an asynchronous action with ticks. The smart thing we do is that the proposed sleep is actually a std::condition_variable in disguise. So, contrariwise to a regular sleep, it can be interrupted if a wake up signal is sent |
Beta Was this translation helpful? Give feedback.
-
And in which cases a wake up signal is sent? Moreover, what could actually happen by shortening the sleep period? |
Beta Was this translation helpful? Give feedback.
Answer from @facontidavide :
Since the concept of ticking a tree is basically "polling", we don't want to consume 100% of the cpu, bombarding an asynchronous action with ticks.
The smart thing we do is that the proposed sleep is actually a std::condition_variable in disguise.
So, contrariwise to a regular sleep, it can be interrupted if a wake up signal is sent