aboutsummaryrefslogtreecommitdiff
path: root/demo/async
diff options
context:
space:
mode:
Diffstat (limited to 'demo/async')
-rw-r--r--demo/async/CMakeLists.txt24
-rw-r--r--demo/async/README.adoc9
2 files changed, 31 insertions, 2 deletions
diff --git a/demo/async/CMakeLists.txt b/demo/async/CMakeLists.txt
new file mode 100644
index 00000000..614bcfc3
--- /dev/null
+++ b/demo/async/CMakeLists.txt
@@ -0,0 +1,24 @@
+#
+# Copyright 2018 Capitar IT Group BV <info@capitar.com>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+
+cmake_minimum_required (VERSION 2.8.7)
+
+project(nng-asyncdemo)
+
+set(PARALLEL 128 CACHE STRING "Parallelism (min 4, max 1000)")
+
+# Call this from your own project's makefile.
+find_package(nng CONFIG REQUIRED)
+
+add_executable(server server.c)
+target_link_libraries(server nng::nng)
+target_compile_definitions(server PRIVATE -DPARALLEL=${PARALLEL})
+
+add_executable(client client.c)
+target_link_libraries(client nng::nng)
diff --git a/demo/async/README.adoc b/demo/async/README.adoc
index ec91c722..87c44cec 100644
--- a/demo/async/README.adoc
+++ b/demo/async/README.adoc
@@ -6,8 +6,11 @@ processing with minimal fuss.
== Compiling
-You can override the level of concurrency with the `PARALLEL`
-define. This determines how many requests the server will accept
+This is set up for configuration with CMake for ease of use.
+
+You can override the level of concurrency with the `PARALLEL` option.
+
+This determines how many requests the server will accept
at a time, and keep outstanding. Note that for our toy implementation,
we create this many "logical" flows of execution (contexts) (these are
_NOT_ threads), where a request is followed by a reply.
@@ -20,6 +23,8 @@ you can't have more than one client per descriptor. Contexts can be used
on the client side to support many thousands of concurrent requests over
even just a single TCP connection, however.)
+You can also build this all by hand with Make or whatever.
+
On UNIX-style systems:
[source, bash]