Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Aug 7, 2023
1 parent d133870 commit 290795a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
1 change: 1 addition & 0 deletions examples/xtd.core.examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
## [Threading](threading/README.md)

* [auto_reset_event](threading/auto_reset_event/README.md) shows how to use [xtd::threading::auto_reset_event](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1auto_reset_event.html) class.
* [event_wait_handle](threading/event_wait_handle/README.md) shows how to use [xtd::threading::event_wait_handle](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1event__wait__handle.html) class.
* [interlocked](threading/interlocked/README.md) shows hows how to use [xtd::threading::interlocked](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html) class.
* [interlocked_decrement](threading/interlocked_decrement/README.md) shows hows how to use [xtd::threading::interlocked::decrement](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html#a4f4545f0c5952db7df8ff6fc4aa41067) and [xtd::threading::interlocked::increment](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html#acf60d0d23279ede3b23ddee39265aadd) methods.
* [mixing_std_and_xtd_threads](threading/mixing_std_and_xtd_threads/README.md) shows how to use and mixing [xtd::threading::thread](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1thread.html) and [std::thread](https://en.cppreference.com/w/cpp/thread/thread) classes.
Expand Down
2 changes: 2 additions & 0 deletions examples/xtd.core.examples/threading/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
[This folder](.) contains network examples used by [Reference Guide](https://gammasoft71.github.io/xtd/reference_guides/latest/) and more.

* [auto_reset_event](auto_reset_event/README.md) shows how to use [xtd::threading::auto_reset_event](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1auto_reset_event.html) class.
* [event_wait_handle](event_wait_handle/README.md) shows how to use [xtd::threading::event_wait_handle](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1event__wait__handle.html) class.
* [interlocked](interlocked/README.md) shows hows how to use [xtd::network::interlocked](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html) class.
* [interlocked_decrement](interlocked_decrement/README.md) shows hows how to use [xtd::threading::interlocked::decrement](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html#a4f4545f0c5952db7df8ff6fc4aa41067) and [xtd::threading::interlocked::increment](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1interlocked.html#acf60d0d23279ede3b23ddee39265aadd) methods.
* [mixing_std_and_xtd_threads](mixing_std_and_xtd_threads/README.md) shows how to use and mixing [xtd::threading::thread](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1thread.html) and [std::thread](https://en.cppreference.com/w/cpp/thread/thread) classes.
* [thread](thread/README.md) shows hows how to use [xtd::threading::thread](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1thread.html) class.

71 changes: 36 additions & 35 deletions examples/xtd.core.examples/threading/event_wait_handle/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# auto_reset_event
# event_wait_handle

Shows how to use [xtd::threading::auto_reset_event](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1auto_reset_event.html) class.
Shows how to use [xtd::threading::event_wait_handle](https://gammasoft71.github.io/xtd/reference_guides/latest/classxtd_1_1threading_1_1event__wait__handle.html) class.

## Sources

[src/auto_reset_event.cpp](src/auto_reset_event.cpp)
[src/event_wait_handle.cpp](src/event_wait_handle.cpp)

[CMakeLists.txt](CMakeLists.txt)

Expand All @@ -19,36 +19,37 @@ xtdc run
# Output

```
Press Enter to create three threads and start them.
The threads wait on auto_reset_event #1, which was created
in the signaled state, so the first thread is released.
This puts auto_reset_event #1 into the unsignaled state.
thread_0x16fe87000 waits on auto_reset_event #1.
thread_0x16fe87000 is released from auto_reset_event #1.
thread_0x16fe87000 waits on auto_reset_event #2.
thread_0x16ff13000 waits on auto_reset_event #1.
thread_0x16ff9f000 waits on auto_reset_event #1.
Press Enter to release another thread.
thread_0x16ff9f000 is released from auto_reset_event #1.
thread_0x16ff9f000 waits on auto_reset_event #2.
Press Enter to release another thread.
thread_0x16ff13000 is released from auto_reset_event #1.
thread_0x16ff13000 waits on auto_reset_event #2.
All threads are now waiting on auto_reset_event #2.
Press Enter to release a thread.
thread_0x16ff9f000 is released from auto_reset_event #2.
thread_0x16ff9f000 ends.
Press Enter to release a thread.
thread_0x16fe87000 is released from auto_reset_event #2.
thread_0x16fe87000 ends.
Press Enter to release a thread.
thread_0x16ff13000 is released from auto_reset_event #2.
thread_0x16ff13000 ends.
Thread 2 blocks.
Thread 4 blocks.
Thread 0 blocks.
Thread 1 blocks.
Thread 3 blocks.
Press ENTER to release a waiting thread.
Thread 4 exits.
Press ENTER to release a waiting thread.
Thread 2 exits.
Press ENTER to release a waiting thread.
Thread 0 exits.
Press ENTER to release a waiting thread.
Thread 1 exits.
Press ENTER to release a waiting thread.
Thread 3 exits.
Thread 0 blocks.
Thread 1 blocks.
Thread 3 blocks.
Thread 2 blocks.
Thread 4 blocks.
Press ENTER to release the waiting threads.
Thread 2 exits.
Thread 1 exits.
Thread 4 exits.
Thread 3 exits.
Thread 0 exits.
```

0 comments on commit 290795a

Please sign in to comment.