Meaning of Tree.sleep() #656
Answered
by
MatteoAlbi
MatteoAlbi
asked this question in
Q&A
|
My question is why do we need to add a sleep interval in the tick cycle of the tree? |
Answered by
MatteoAlbi
Sep 8, 2023
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 |
0 replies
Answer selected by
MatteoAlbi
|
And in which cases a wake up signal is sent? Moreover, what could actually happen by shortening the sleep period? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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