Skip to content

Commit

Permalink
Converted multithreading example to documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-crowhurst committed Apr 14, 2018
1 parent f8dd3b0 commit 370d6a0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
@@ -1,13 +1,12 @@
/*
* Example illustrating multithreaded services.
*
* Server Usage:
* ./distribution/example/multithreaded_service
*
* Client Usage:
* curl -w'\n' -v -X GET 'http://localhost:1984/resource'
*/
Overview
--------

"In computer architecture, multithreading is the ability of a central processing unit (CPU) or a single core in a multi-core processor to execute multiple processes or threads concurrently, appropriately supported by the operating system." -- [Wikipedia](https://en.wikipedia.org/wiki/Multithreading_(computer_architecture))

Example
-------

```C++
#include <memory>
#include <thread>
#include <cstdlib>
Expand Down Expand Up @@ -43,3 +42,16 @@ int main( const int, const char** )

return EXIT_SUCCESS;
}
```
Build
-----
> $ clang++ -o example example.cpp -l restbed
Execution
---------
> $ ./example
>
> $ curl -w'\n' -v -X GET 'http://localhost:1984/resource'
3 changes: 0 additions & 3 deletions example/CMakeLists.txt
Expand Up @@ -34,9 +34,6 @@ target_link_libraries( compression ${STATIC_LIBRARY_NAME} )
add_executable( rules_engine rules_engine/source/example.cpp )
target_link_libraries( rules_engine ${STATIC_LIBRARY_NAME} )

add_executable( multithreaded_service multithreaded_service/source/example.cpp )
target_link_libraries( multithreaded_service ${STATIC_LIBRARY_NAME} )

add_executable( schedule_work_on_service_runloop schedule_work_on_service_runloop/source/example.cpp )
target_link_libraries( schedule_work_on_service_runloop ${STATIC_LIBRARY_NAME} )

Expand Down

0 comments on commit 370d6a0

Please sign in to comment.