Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: GR-PEACH-webcam GR-Boards_WebCamera GR-Boards_WebCamera GR-Boards_WebCamera
Fork of HttpServer_snapshot by
Revision 18:673d663a1ed7, committed 2019-09-13
- Comitter:
- dkato
- Date:
- Fri Sep 13 02:08:33 2019 +0000
- Parent:
- 17:6b7076372285
- Commit message:
- Add macro HTTP_SERVER_THREAD_MAX (default 1)
Changed in this revision
| HTTPServer.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/HTTPServer.h Wed Jul 03 11:23:12 2019 +0000
+++ b/HTTPServer.h Fri Sep 13 02:08:33 2019 +0000
@@ -155,12 +155,14 @@
return ;
}
-#define THREAD_MAX 3
+#ifndef HTTP_SERVER_THREAD_MAX
+#define HTTP_SERVER_THREAD_MAX 1
+#endif
-#if (THREAD_MAX > 1)
-static Thread *threads[THREAD_MAX];
-static bool soket_rady[THREAD_MAX];
-static TCPSocket * clients[THREAD_MAX];
+#if (HTTP_SERVER_THREAD_MAX > 1)
+static Thread *threads[HTTP_SERVER_THREAD_MAX];
+static bool soket_rady[HTTP_SERVER_THREAD_MAX];
+static TCPSocket * clients[HTTP_SERVER_THREAD_MAX];
static void HTTPServerChild (void* param)
{
@@ -180,7 +182,7 @@
int i;
TCPSocket server;
- for (i = 0; i < THREAD_MAX; i++) {
+ for (i = 0; i < HTTP_SERVER_THREAD_MAX; i++) {
soket_rady[i] = true;
threads[i] = new Thread(priority, 1024 * 3);
threads[i]->start(callback(HTTPServerChild, (void *)i));
@@ -193,12 +195,12 @@
while (1) {
while (1) {
- for (i = 0; i < THREAD_MAX; i++) {
+ for (i = 0; i < HTTP_SERVER_THREAD_MAX; i++) {
if (soket_rady[i] != false) {
break;
}
}
- if (i < THREAD_MAX) {
+ if (i < HTTP_SERVER_THREAD_MAX) {
break;
}
ThisThread::sleep_for(5);
@@ -213,7 +215,7 @@
}
}
-#else // THREAD_MAX == 1
+#else // HTTP_SERVER_THREAD_MAX == 1
void HTTPServerStart(NetworkInterface *net, int port = 80, osPriority priority = osPriorityNormal)
{
