You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
STL provides POSIX thread primitives to MATLAB® code that has been converted to C code using the MATLAB Coder® toolchain. It allows multi-threaded operation on Linux and MacOS platforms (I don't have access to Windows to test).
6
6
7
-
STL provides threads, semaphores, mutexes, high resolution delay, timers (Linux only), and logging.
7
+
STL provides threads, semaphores, mutexes, high resolution delay, timers (Linux only), logging and an embedded web server that supports templating.
8
8
9
9
To use this you must have a licence for MATLAB® and MATLAB Coder®.
10
10
11
11
More details in the [project Wiki](https://github.com/petercorke/simple-threads-coder/wiki).
12
12
13
-
## Collaborate
13
+
Also listed in [MATLAB File Exchange](https://www.mathworks.com/matlabcentral/fileexchange/68648-simple-threads-coder).
14
14
15
-
If you download and test this, please send me your feedback. If you're interested in helping with development, even better, please contact me and we can make a plan. A non-exhaustive list of development topics is at the end of this document.
15
+
## Collaborate
16
16
17
+
If you download and test this, please send me your feedback. If you're interested in helping with development, even better, please contact me and we can make a plan. A non-exhaustive list of short- and long-term development topics is on the [Wiki](https://github.com/petercorke/simple-threads-coder/wiki).
17
18
18
19
19
-
## An example
20
+
## Example 1: Threading
20
21
21
22
Consider this example with one main function and three additional threads. You can find this in `examples/threads`.
22
23
@@ -104,7 +105,7 @@ function thread3() %#codegen
104
105
end
105
106
```
106
107
107
-
## Building and running the application
108
+
###Building and running the application
108
109
109
110
```matlab
110
111
>> make
@@ -175,5 +176,37 @@ got 4 arguments
175
176
2018-08-27 09:25:09.485149 [thread3] waiting for semaphore #0 <sem1>
176
177
```
177
178
179
+
## Example 2: Web server
180
+
```matlab
181
+
function myserver() % called on every page request
182
+
switch (webserver.url())
183
+
case '/'
184
+
webserver.html('hello world'); % display a simple string
0 commit comments