Answer the question
In order to leave comments, you need to log in
Timer and linearity?
Hello
I'm new to your field
And I can't figure out how a timer works and something else at the same time
If programming languages are done like this:
---> a = 6
---> if a == 6:
---> ..
So how can two subroutines run at the same time ? ( my function and timer )
---> myFunc() and then timer()
PS please don't laugh if the question seemed silly to you
Answer the question
In order to leave comments, you need to log in
I have such an example - the template is one, but the title is different. How I did it:
1) Template file:
doctype html
block variables
html(lang= "ru")
head
meta(charset="utf-8")
title #{title}
extends ../_template
block variables
- var title = "Главная страница"
block content
There may be different options here. But the most common is "event-driven programming".
In simplified form, it looks like this:
while (true) //event loop
{
if (queue.empty())
continue;
auto event = queue.front();
queue.pop_front();
process(event);
}
onButton()
{
...
}
onTimer()
{
...
}
process(Event event)
{
if (isTimetEvent(event))
onTimer();
if (isButtonEvent(event))
onButton();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question