From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28596 invoked by alias); 26 Apr 2007 09:50:31 -0000 Received: (qmail 28586 invoked by uid 22791); 26 Apr 2007 09:50:30 -0000 X-Spam-Check-By: sourceware.org Received: from anchor-post-34.mail.demon.net (HELO anchor-post-34.mail.demon.net) (194.217.242.92) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Apr 2007 10:50:26 +0100 Received: from calivar.demon.co.uk ([83.104.54.243] helo=xl5.calivar.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1Hh0cI-000CHo-E8; Thu, 26 Apr 2007 09:50:22 +0000 Received: from xl5.calivar.com (localhost [127.0.0.1]) by xl5.calivar.com (Postfix) with ESMTP id 81F651386AA; Thu, 26 Apr 2007 10:50:21 +0100 (BST) To: "Venkateswara Rao L." Cc: References: From: Nick Garnett Original-Sender: nickg@ecoscentric.com Date: Thu, 26 Apr 2007 09:50:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Subject: Re: [ECOS] Using a Mix of Posix and native calls. X-SW-Source: 2007-04/txt/msg00142.txt.bz2 "Venkateswara Rao L." writes: > Hi, > > I've just started working on ecos. I've a basic query. > > > > Suppose, we use ecos native call(cyg_thread_create) to create a > task(TASK A). We have another timer task that implements the software > timers. > > We have a func. timerAdd(), that sets the timeout call. It uses > pthread_cleanup_push with actual "internal timer add function" as > argument, followed by pthread_cleanup_pop(1) to execute the registered > handler. The function timerAdd() is called in the context of TASK A. > We are getting exception while executing pthread push and pop > instructions. It looks to me that this exception might be happening > because the task which makes a call to the above mentioned posix calls, > was not created using posix pthread routines. > > > > Is my understanding correct? Can we have a mix of posix and native calls > under some conditions? In general, you can call non-POSIX functions from POSIX threads, but you cannot call POSIX functions from non-POSIX threads. This is because POSIX threads have extra state associated with them such as signal masks, per-thread data, and the root of the cleanup stack. This latter item is what was missing when you attempted to use pthread_cleanup_* from an non-POSIX thread. So you need to make that thread a POSIX thread. -- Nick Garnett eCos Kernel Architect eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss