Skip to content

Static thread controller#13

Merged
ivanseidel merged 5 commits into
ivanseidel:masterfrom
CAHEK7:StaticThreadController
Sep 6, 2016
Merged

Static thread controller#13
ivanseidel merged 5 commits into
ivanseidel:masterfrom
CAHEK7:StaticThreadController

Conversation

@CAHEK7

@CAHEK7 CAHEK7 commented Sep 2, 2016

Copy link
Copy Markdown
Contributor

This is suggested solution for #6.

Comment thread README.md Outdated
```
or
```c++
// Instantiate a new StaticThreadController

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

"Instantiate a new StaticThreadController with the number of threads to be supplied"

@ivanseidel

Copy link
Copy Markdown
Owner

Nice work! Thanks for contributing.
One additional thing I would love, is to have an example of use of a StaticThreadController. Can you thing in something easy, that "improves" and shows a use case for it?

Thanks

@CAHEK7

CAHEK7 commented Sep 4, 2016

Copy link
Copy Markdown
Contributor Author

Thanks for feedback, seems like I should revise my initial idea and do some adjustments in the code.
As about improvements - Static version is a bit more efficient since it doesn't contain "empty" entries and shouldn't iterate over them. Also it doesn't have any size limitations except available memory.
As about use case - everywhere if you don't need dynamically add or remove threads.

@CAHEK7

CAHEK7 commented Sep 4, 2016

Copy link
Copy Markdown
Contributor Author

Static version is more efficient even if it holds 15 threads, because it "adds" threads to the array at compile time. It may save about 200-300 byte of memory. Just replaced Threads with Thread* and did the measurements.

@ivanseidel ivanseidel merged commit 006a5aa into ivanseidel:master Sep 6, 2016
@ivanseidel

Copy link
Copy Markdown
Owner

Thank you very much @CAHEK7! Just published the version. https://github.com/ivanseidel/ArduinoThread/releases/tag/2.1.0

Bumped from 2.0.3 to 2.1.0 as it includes new features.

@CAHEK7 CAHEK7 deleted the StaticThreadController branch September 6, 2016 16:36
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.

2 participants