-
Notifications
You must be signed in to change notification settings - Fork 64
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
Differentiation between multi-threaded and single-threaded preprocessor directives in C #1411
Conversation
…-threaded runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay. I'm not sure this change makes sense. I suspect that tracing won't actually work in an unthreaded runtime, otherwise I don't know why it would be setting NUMBER_OF_WORKERS.
For LET scheduling we need to know, in reactor_common.c whether we are in a single-threaded or multi-threaded runtime. This cannot be checked by
I.e. I don't really need a new flag, but it seems a bit clunky |
Ah, I see. I think the reason is simply that tracing needs a to report a thread number. There may be a better solution, but your solution seems fine, let's merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this.
Who can merge this for me? @lhstrh ? |
@erlingrj: Just resolved a conflict and waiting for CI. We can merge soon as we're green! |
This PR adds two compiler definitions to the C target:
LF_MULTI_THREADED
andLF_SINGLE_THREADED
which reflect the target property "threading". I have previously used NUMBER_OF_WORKERS to try to get the same info, however, NUMBER_OF_WORKERS is defined even ifthreading: false
, iftracing: true
.Thus I propose to make the fact that we are single-threaded or multi-threaded globally available. It would suffice with only a single flag, but I think it is clearer with a "positive definition" of something than a negative.