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

gcc -O1 and async/thread #146

Open
wluker opened this issue Feb 27, 2020 · 0 comments
Open

gcc -O1 and async/thread #146

wluker opened this issue Feb 27, 2020 · 0 comments

Comments

@wluker
Copy link

wluker commented Feb 27, 2020

The async/thread example at https://github.com/ceu-lang/ceu/blob/master/samples/test-03.ceu works with default compiler settings, but doesn't work when optimization is turned on -O1.

CEU_SRC=./samples/test-03.ceu CEU_ARGS="--ceu-features-async=true --ceu-features-thread=true --ceu-features-dynamic=true" CC_ARGS="-O0" make one

/tmp/test-03 works as expected, but change -O0 to -O1 and ceu starts the thread, but the main ceu loop then blocks

wluker added a commit to wluker/ceu that referenced this issue Feb 27, 2020
This takes care of issue ceu-lang#146 , but there are probably other areas that still might need to be protected from being optimized away.

For example, should the volatile keyword be added to any variables declared in the main thread, but made visible to the child thread?

And then there is the assignment in the child thread:
`_ceu_mem->_trails[2].evt.id = CEU_INPUT__NONE;`
Does that ever need to be protected?
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