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

Suggestion - macro to make multi-threaded calls single-threaded #174

Open
lipx1508 opened this issue Mar 26, 2023 · 0 comments
Open

Suggestion - macro to make multi-threaded calls single-threaded #174

lipx1508 opened this issue Mar 26, 2023 · 0 comments

Comments

@lipx1508
Copy link

Hello!
Just to warn before explaining that it's my first time opening an issue, so if I say a misconception, I have my mind open for this.

The proposal is making threaded calls like "async" and "await" have a macro to not use threads at all, like MUJS_SINGLETHREADED.
The most common method for making multi-threaded calls single-threaded is faking it, like how some OS's and kernels do, for example:

unsigned int thread_id; // ID of the thread

while (1) { // Loop example
    switch (thread_id) { // Executes call on thread
        case 0: ...
        case 1: ...
    }
}

I was going to make a pull request with more context and an in-practice application for it, but I'm not really sure if it would be viable giving the context.

Thanks for reading, have a good morning, afternoon or night :)

@lipx1508 lipx1508 changed the title Suggestion - macro to make multi-threaded calls multi-threaded Suggestion - macro to make multi-threaded calls single-threaded Mar 28, 2023
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

No branches or pull requests

1 participant