From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8111 invoked by alias); 24 Jun 2014 22:34:18 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 8068 invoked by uid 89); 24 Jun 2014 22:34:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_05 autolearn=ham version=3.3.2 X-HELO: tetra.codeconfidence.com Received: from tetra.codeconfidence.com (HELO tetra.codeconfidence.com) (94.229.66.225) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jun 2014 22:34:14 +0000 Received: from cog.dallaway.org.uk (cpc1-cmbg1-0-0-cust759.5-4.cable.virginm.net [82.21.98.248]) by tetra.codeconfidence.com (Postfix) with ESMTP id 4E0B4234C043; Tue, 24 Jun 2014 23:34:12 +0100 (BST) Received: from cog.dallaway.org.uk (cog.dallaway.org.uk [127.0.0.1]) by cog.dallaway.org.uk (8.13.8/8.13.8) with ESMTP id s5OMY5Ne017975; Tue, 24 Jun 2014 23:34:06 +0100 Message-ID: <53A9FCDD.5000600@dallaway.org.uk> Date: Tue, 24 Jun 2014 22:34:00 -0000 From: John Dallaway User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Andrew Hannam CC: eCos Discussion References: <002601cf8fbd$3ff8bad0$bfea3070$@inmarket.com.au> In-Reply-To: <002601cf8fbd$3ff8bad0$bfea3070$@inmarket.com.au> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [ECOS] Re: Couple of porting questions X-SW-Source: 2014-06/txt/msg00022.txt.bz2 Hi Andrew On 24/06/14 16:01, Andrew Hannam wrote: > 1/ Is there any method of detecting from a thread handle whether the thread > that handle refers to is still runnable ie. hasn't exited or been killed? Take a look at cyg_thread_get_info(). > 2/ Is there any way of detecting if cyg_scheduler_start() has already been > called or, is it safe to call it multiple times with no side effects or, can > it be assumed that cyg_scheduler_start() has already been called when main() > is invoked (if the kernel is included)? In general, the eCos application developer creates threads within the cyg_user_start() function and the scheduler is started by system code when cyg_user_start() exits. Support for main() is dependent on the CYGPKG_LIBC_STARTUP package being included and the context in which main() is called is configurable. It would be better to avoid reliance on C library startup in system-level code if at all possible. If you must use main() as an entry point for some reason, take a look at the descriptions of the CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT and CYGSEM_LIBC_STARTUP_MAIN_THREAD options. > 3/ Is there any approved method of halting the system (eg due to an > unrecoverable soft error) or is calling the C library exit() or _exit() > sufficient? The C library might not be present. You might simply enter a tight loop: for (;;) CYG_EMPTY_STATEMENT; > 4/ Can stdout output be relied upon on all platforms? Is stdout and/or > stderr assumed to be a debug/monitor output stream? Again, the C library might not be present. You can use diag_printf() for debug output or one of the configurable CYG_TRACE*() macros. I hope this helps... John Dallaway eCos maintainer http://www.dallaway.org.uk/john -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss