Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Tue, 16 Feb 2021 14:56:02 -0800 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 11GMgaR6019910; Tue, 16 Feb 2021 17:43:22 -0500 Received: from outgoing-exchange-5.mit.edu (OUTGOING-EXCHANGE-5.MIT.EDU [18.9.28.59]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 11GMgZcZ019906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Feb 2021 17:42:35 -0500 Received: from oc11exedge2.exchange.mit.edu (OC11EXEDGE2.EXCHANGE.MIT.EDU [18.9.3.18]) by outgoing-exchange-5.mit.edu (8.14.7/8.12.4) with ESMTP id 11GMgYCL031447 for ; Tue, 16 Feb 2021 17:42:34 -0500 Received: from oc11exhyb2.exchange.mit.edu (18.9.1.98) by oc11exedge2.exchange.mit.edu (18.9.3.18) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 16 Feb 2021 17:42:28 -0500 Received: from oc11exhyb6.exchange.mit.edu (18.9.1.111) by oc11exhyb2.exchange.mit.edu (18.9.1.98) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Feb 2021 17:42:34 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by oc11exhyb6.exchange.mit.edu (18.9.1.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 16 Feb 2021 17:42:33 -0500 Received: from CO2PR04CA0117.namprd04.prod.outlook.com (2603:10b6:104:7::19) by BYAPR01MB5541.prod.exchangelabs.com (2603:10b6:a03:119::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.41; Tue, 16 Feb 2021 22:42:31 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::26) by CO2PR04CA0117.outlook.office365.com (2603:10b6:104:7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 22:42:31 +0000 Received: from mailscanner.virtbiz.com (208.80.15.114) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 16 Feb 2021 22:42:30 +0000 Received: from s18855546.onlinehome-server.com (s18855546.onlinehome-server.com [74.208.193.200]) by mailscanner.virtbiz.com (8.14.7/8.14.7) with ESMTP id 11GMgAmX001204 for ; Tue, 16 Feb 2021 16:42:14 -0600 Received: from mai.hallikainen.org (localhost [127.0.0.1]) by s18855546.onlinehome-server.com (8.14.4/8.14.4) with ESMTP id 11GIhM4h004111 for ; Tue, 16 Feb 2021 10:43:22 -0800 Received: (from apache@localhost) by mai.hallikainen.org (8.14.4/8.14.4/Submit) id 11GIhMo6004105; Tue, 16 Feb 2021 10:43:22 -0800 Received: from 174.16.109.139 (SquirrelMail authenticated user harold) by mai.hallikainen.org with HTTP; Tue, 16 Feb 2021 10:43:22 -0800 From: Harold Hallikainen To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Tue, 16 Feb 2021 10:43:22 -0800 Subject: Re: [EE]:: Simple Task Scheduler written in C Thread-Topic: [EE]:: Simple Task Scheduler written in C Thread-Index: AdcEtuaDuCZ2LHs+RKWMhnUGqsVZPA== Message-ID: <475a577b94f666c787f1b28acc17d044.squirrel@mai.hallikainen.org> References: List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: Pass (protection.outlook.com: domain of mai.hallikainen.org designates 208.80.15.114 as permitted sender) receiver=protection.outlook.com; client-ip=208.80.15.114; helo=mailscanner.virtbiz.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitprod.onmicrosoft.com; s=selector2-mitprod-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eDi/QkwYvykb/HgOKIy4kWb5GAhou/cgsZ2uh3cmFZk=; b=XM5ajx596AryyRfKJRwXnPTT6VS4Y/XtFCI1kgqXWMLA5ny/cBW0rdLjJ5+HFB0NZDtin7zgy5f241ocBun7iSEly2oF4ImPQVY+f7MashoH7O3BrsDjMIaUM5jNLrYAJnu1PkdvW18hChrIPe4DOsosAPhbATAOkCIGCaRhN+I= authentication-results: spf=pass (sender IP is 208.80.15.114) smtp.mailfrom=mai.hallikainen.org; mit.edu; dkim=none (message not signed) header.d=none;mit.edu; dmarc=permerror action=none header.from=mai.hallikainen.org; user-agent: SquirrelMail/1.4.22-5.el6 errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-authentication-warning: mai.hallikainen.org: apache set sender to harold@mai.hallikainen.org using -f x-spam-status: No x-greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mailscanner.virtbiz.com [208.77.216.252]); Tue, 16 Feb 2021 16:42:14 -0600 (CST) x-topics: [EE] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks for posting! I've really gotten use to just using state machines with switch/case statements. Each "task" has an input FIFO that other tasks can dump complete messages into. When the main loop calls a task, it immediately returns if there is nothing in its input FIFO. If there is something there, it acts on each message, generally outputting to other task input FIFOs. Not preemptive, but simple! If needed, priority of a task can be increased by putting it in the main loop more than once. Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com Not sent from an iPhone. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .