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

ThreadUtil: don't use thread APIs if multithreading&commix aren't in use #3884

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubukoz
Copy link
Contributor

@kubukoz kubukoz commented Apr 17, 2024

Closes #3877

Comment on lines +11 to +17
INLINE
bool mutex_init(mutex_t *ref) { return true; }

INLINE bool mutex_lock(mutex_t *ref) { return true; }

INLINE bool mutex_unlock(mutex_t *ref) { return true; }
#else
Copy link
Contributor Author

Choose a reason for hiding this comment

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

question: I only needed these three so I implemented only these. Perhaps we should do this on a per-function basis?

Comment on lines +5 to +6
#if !(defined SCALANATIVE_GC_COMMIX || \
defined SCALANATIVE_MULTITHREADING_ENABLED)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought: it'd be good to have a single definition that we can check, e.g. "has pthread" - does something like this exist already?

Copy link
Contributor Author

@kubukoz kubukoz Apr 17, 2024

Choose a reason for hiding this comment

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

also, is this fine or would you rather I flip the boolean (concurrent case first, fallback second)?

Copy link
Member

Choose a reason for hiding this comment

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

By default, all the shared code should be compiled so something is not correct 100%. The SCALANATIVE_GC_COMMIX is defined only when selecting Commix so that code will get compiled and similar for other GCs. Does this help at all?

Copy link
Member

Choose a reason for hiding this comment

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

It is used by all the internal GCs and also single threaded runtime because no guard against.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm yeah. What I did here was inspired by Wojciech's comment on the ticket, but I see that this might not be the best way to do it because it's not really "shared" anymore.

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.

(playdate support) Missing pthread APIs in ThreadUtil
2 participants