Skip to content

Conversation

@Xmader
Copy link
Member

@Xmader Xmader commented Apr 10, 2024

  • Implement setInterval/clearInterval global functions
    See MDN and the spec

  • Fix a memory bug that limits the number of setTimeout/setInterval timers could be run

  • Fix pmjs -e/pmjs -p not being able to call functions that require the event-loop


Closes #266

Xmader added 6 commits April 5, 2024 19:23
…` timers could be run

When a `std::vector` gets expanded, reallocation happens, and the memory block is moved to somewhere else.
We could no longer use a pointer to the handle after reallocation, but no problem if we use indices (i.e. the `timeoutId`).
@Xmader Xmader marked this pull request as draft April 10, 2024 02:46
@Xmader Xmader force-pushed the Xmader/feat/timers-setInterval branch from f625c0b to 962ff2d Compare April 10, 2024 04:06
@Xmader Xmader marked this pull request as ready for review April 11, 2024 15:49
fix English

Co-authored-by: philippedistributive <151072087+philippedistributive@users.noreply.github.com>
Co-authored-by: philippedistributive <151072087+philippedistributive@users.noreply.github.com>
Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from one missing decref

A new reference to `jobFn` is created in `enqueueWithDelay` by `PyCFunction_New`, so we are safe to decrease the reference count here.

Co-authored-by: Caleb Aikens <caleb@distributive.network>
zollqir

This comment was marked as outdated.

Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

Copy link
Collaborator

@zollqir zollqir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xmader Xmader merged commit 9903362 into main Apr 11, 2024
@Xmader Xmader deleted the Xmader/feat/timers-setInterval branch April 11, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setInterval/clearInterval have gone missing

4 participants