Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sio):implemented Spinlocks #40

Merged
merged 3 commits into from
May 25, 2021
Merged

feat(sio):implemented Spinlocks #40

merged 3 commits into from
May 25, 2021

Conversation

Turro75
Copy link
Contributor

@Turro75 Turro75 commented May 24, 2021

I choose to avoid 32 spinlocks cases by inserting if statements in both read/writeUint32

Copy link
Contributor

@urish urish left a comment

Choose a reason for hiding this comment

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

Thanks! Left some comments about the structure of the code

src/sio.ts Outdated Show resolved Hide resolved
src/sio.ts Show resolved Hide resolved
src/sio.ts Show resolved Hide resolved
@urish urish linked an issue May 24, 2021 that may be closed by this pull request
@urish
Copy link
Contributor

urish commented May 24, 2021

And a quick note about ranges for switch in JavaScript: it is possible, but in a weird way. For example:

switch (true) {
   case i === 0: return "zero";
   case i > 0 && i < 10: return "single digit";
   case i < 100: return "two digits";
   default: return "big number!";
}

But I don't think it's a good practice. Using an if statement is probably a better solution, especially in our case.

p.s. there's also a proposal for new JavaScript syntax that will probably able to deal with ranges. But it's just an early stage proposal right now...

src/sio.ts Show resolved Hide resolved
@urish urish merged commit b97dc5f into wokwi:master May 25, 2021
@urish
Copy link
Contributor

urish commented May 25, 2021

Thanks!

@Turro75 Turro75 deleted the Spinlocks branch May 25, 2021 20:34
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.

SIO Hardware Spinlocks
2 participants