TINF_Thread

Revision:
0:195b16812a42
diff -r 000000000000 -r 195b16812a42 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 21 16:23:46 2019 +0000
@@ -0,0 +1,53 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2018 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"
+ 
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+Thread thread;
+Thread thread3;
+ 
+void led2_thread() {
+    double x, y = 1.99, z = 0.99;
+    while (true) {
+        led2 = !led2;
+        wait(1);
+        
+        for(int j=0; j<100; j++)
+            for(int i=0; i<100000; i++)
+                int x = y * z * x;
+        
+    }
+}
+
+void led3_thread() {
+    double x, y = 1.99, z = 0.99;
+    while (true) {
+        led3 = !led3;
+        wait(1);
+        
+        for(int j=0; j<100; j++)
+            for(int i=0; i<100000; i++)
+                int x = y * z * x;
+        
+    }
+}
+ 
+int main() {
+    double x, y = 1.99, z = 0.99;
+    thread.start(led2_thread);
+    thread.start(led3_thread);    
+    
+    while (true) {
+        led1 = !led1;
+        wait(0.5);
+        
+         for(int j=0; j<100; j++)
+            for(int i=0; i<100000; i++)
+                int x = y * z * x;
+    }
+}