Skip to content

Move the EventFlags example to an external repo #803

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions docs/api/rtos/EventFlags.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,10 @@

The EventFlags class provides a mechanism for setting and waiting for specific conditions. It provides a generic way of notifying other threads about conditions or events. You can think of each instance of the EventFlags class as an event channel. There are 31 different flags available for each event.

### EventFlag class reference
### EventFlags class reference
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch 👍


[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/classrtos_1_1_event_flags.html)

### EventFlags example

Below is an example of EventFlags usage, where one thread is generating events every 1s, and the second thread is waiting for the events and executing some action.
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Is this deleted description still relevant? If so, could we please keep it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since I've slightly updated the example code, the description should also be updated. Do you prefer to have it here, or should I rather edit the new README file https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/EventFlags/README.md ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the example is self-explanatory enough that it doesn't need setup, feel free to edit it only in the README file. If the example needs some context, please edit it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

README updated in a new PR ARMmbed/mbed-os-examples-docs_only#8 since the last one got merged already.


<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images//eventflags_usage.png)</span>

```
#include "mbed.h"

EventFlags event;

void worker_f()
{
while (true) {
event.wait_all(0x1);

printf("Got signal!\r\n");
}
}

int main()
{
Thread worker;

worker.start(callback(worker_f));

while (true) {
wait(1);
event.set(0x1);
}
}
```
[![View Example](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-examples-docs_only/EventFlags)](https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/EventFlags/main.cpp)