On Wed, Feb 10, 2021 at 3:53 AM Kalle Huttunen <[email protected]> wrote:

> What about worker threads? If `emscripten_set_timeout` is called in a
> thread other than main, the thread might be blocking somewhere when the
> timer triggers, no? It might also be that I'm misunderstanding some
> fundamental concept here... :)
>
>
In that case the JS timer will never fire.   All events (including timers)
require you to return to the event loop before they fire.  Actually
blocking also blocks all events.

-- 
> Kalle
>
> On Wed, 10 Feb 2021 at 04:50, 'Sam Clegg' via emscripten-discuss <
> [email protected]> wrote:
>
>>
>>
>> On Tue, Feb 9, 2021 at 6:50 AM Kalle Huttunen <[email protected]> wrote:
>>
>>> Came back to this after a while, and it seems that
>>> using `emscripten_set_interval` and `emscripten_set_timeout` would not be a
>>> good option for a general solution after all, as they will try to invoke
>>> the callback in the calling thread, and there's no guarantees what the
>>> calling thread will be doing when the timer triggers. So it seems to me
>>> that some kind of timer specific thread would be needed.
>>>
>>>
>> JavaScript is single threaded, and handlers have to run to completion
>> before another even can fire.  So when timers fire there is, by defintion,
>> nothing else going on the calling thread.  The exception to this is
>> ASYNCIFY which can make it appear that events occur mid-function.  If you
>> are not using ASYNCIFY you don't need to worry about that.
>>
>>
>>> --
>>> Kalle
>>>
>>> On Tue, 1 Sept 2020 at 10:21, Kalle Huttunen <[email protected]> wrote:
>>>
>>>> Ok, thanks for the answer. I started experimenting implementing the
>>>> timers in my code with `emscripten_set_interval` and
>>>> `emscripten_set_timeout` in the web build. Do you think this could be the
>>>> approach also for implementing them in library_syscalls.js?
>>>>
>>>> --
>>>> Kalle
>>>>
>>>> On Thursday, 27 August 2020 at 22:26:32 UTC+3 [email protected] wrote:
>>>>
>>>>> It looks like we do not support that today.  `timer_create.c` is
>>>>> excluded from the musl build in system_libs.py.
>>>>>
>>>>> If you'd like to add it that would be most welcome.  It looks like
>>>>> you'd need to enable that `.c` file and then implement the time_create
>>>>> syscall in library_syscalls.js.
>>>>>
>>>>> cheers,
>>>>> sam
>>>>>
>>>>> On Thu, Aug 27, 2020 at 10:45 AM Kalle Huttunen <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Does Emscripten support POSIX timers? My code using them compiles,
>>>>>> but fails to link with undefined references to timer_create() and 
>>>>>> friends.
>>>>>> I'm wondering am I missing some linker flag etc or are they just not
>>>>>> supported.
>>>>>>
>>>>>> --
>>>>>> Kalle
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "emscripten-discuss" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/emscripten-discuss/b6b76dd4-90ea-453a-ae4a-56355075d061n%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/b6b76dd4-90ea-453a-ae4a-56355075d061n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "emscripten-discuss" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/emscripten-discuss/RDb4CfuoSpA/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/emscripten-discuss/fa5a792f-b10c-4477-9572-8f8f3ab72c4en%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/emscripten-discuss/fa5a792f-b10c-4477-9572-8f8f3ab72c4en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/CACrvwwt3aC7i%2Bm-cPXB8tSgusB2Nt_3-nr3H2c%3DU0YaZnjVQRA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/CACrvwwt3aC7i%2Bm-cPXB8tSgusB2Nt_3-nr3H2c%3DU0YaZnjVQRA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "emscripten-discuss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/emscripten-discuss/RDb4CfuoSpA/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va288_z-gkAip5h7mkou0oCczfi5BuQ581WR3hBQJv_CBjg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va288_z-gkAip5h7mkou0oCczfi5BuQ581WR3hBQJv_CBjg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CACrvwwvG1i39cn6eTYOSvBY-Q4Nu9aa_qNCzJxj0Kn85s%2BOFdw%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CACrvwwvG1i39cn6eTYOSvBY-Q4Nu9aa_qNCzJxj0Kn85s%2BOFdw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_33iAbFerbTFYeXJVt1dM5ysr%2B3Rw20qaSvZTukhee%3Dg%40mail.gmail.com.

Reply via email to