亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? signal.cxx

?? ecos實時嵌入式操作系統(tǒng)
?? CXX
?? 第 1 頁 / 共 3 頁
字號:
//==========================================================================////      signal.cxx////      POSIX signal functions implementation////==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.// Copyright (C) 2002 Nick Garnett//// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.// at http://sources.redhat.com/ecos/ecos-license/// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):           nickg// Contributors:        nickg// Date:                2000-03-27// Purpose:             POSIX signal functions implementation// Description:         This file contains the implementation of the POSIX signal//                      functions.//              //              ////####DESCRIPTIONEND####////==========================================================================#include <pkgconf/posix.h>#ifdef CYGPKG_POSIX_SIGNALS#include <pkgconf/hal.h>#include <pkgconf/kernel.h>#include <pkgconf/isoinfra.h>#include <cyg/kernel/ktypes.h>          // base kernel types#include <cyg/infra/cyg_trac.h>         // tracing macros#include <cyg/infra/cyg_ass.h>          // assertion macros#include "pprivate.h"                   // POSIX private header#include <signal.h>                     // our header#include <setjmp.h>#include <unistd.h>                     // _exit#include <cyg/kernel/clock.hxx>#include <cyg/kernel/thread.hxx>#include <cyg/kernel/clock.inl>#include <cyg/kernel/thread.inl>// -------------------------------------------------------------------------// Internal definitions// Handle entry to a signal package function. #define SIGNAL_ENTRY() CYG_REPORT_FUNCTYPE( "returning %d" );// Do a signal package defined return. This requires the error code// to be placed in errno, and if it is non-zero, -1 returned as the// result of the function. This also gives us a place to put any// generic tidyup handling needed for things like signal delivery and// cancellation.#define SIGNAL_RETURN(err)                      \CYG_MACRO_START                                 \    int __retval = 0;                           \    if( err != 0 ) __retval = -1, errno = err;  \    CYG_REPORT_RETVAL( __retval );              \    return __retval;                            \CYG_MACRO_END// Similarly for functions that have valid non-zero returns#define SIGNAL_RETURN_VALUE(val)                \CYG_MACRO_START                                 \    CYG_REPORT_RETVAL( val );                   \    return val;                                 \CYG_MACRO_END// Range check on a signal value.#define SIGNAL_VALID(_sig_) (((_sig_) > 0) && ((_sig_) < ((int)sizeof(sigset_t)*8)))//==========================================================================// Signal management structurestypedef struct signal_info{    struct signal_info          *next;  // link in list of pending signals    siginfo_t                   si;     // siginfo to pass to handler} signal_info;typedef struct{    struct sigaction            sa;     // Sigaction defining what to do    signal_info                 *pending; // List of pending signals - this is                                          // a circular list with pending pointing                                          // to the tail element (or NULL if empty).} signal_state;//==========================================================================// Signal management variables// Lock used to protect signal management structuresCyg_Mutex signal_mutex CYGBLD_POSIX_INIT;// Condition variable for all threads in sigsuspend() and sigwait()// to wait on.Cyg_Condition_Variable signal_sigwait( signal_mutex ) CYGBLD_POSIX_INIT;// Global pending signal setsigset_t sig_pending;// Array controlling signal statesstatic signal_state sigstate[sizeof(sigset_t)*8];// Array of available signal_info objects for queueing signalsstatic signal_info siginfo[SIGQUEUE_MAX];// List of free signal_info objectsstatic signal_info *siginfo_next = NULL;//==========================================================================// Variables used to support alarm()// Forward def of action functionstatic void sigalrm_action( Cyg_Alarm *alarm, CYG_ADDRWORD data );// Kernel alarm objectstatic Cyg_Alarm sigalrm_alarm( Cyg_Clock::real_time_clock, sigalrm_action, 0 ) CYGBLD_POSIX_INIT;// Set true when alarm is armedvolatile cyg_bool sigalrm_armed = false;// Set true when alarm has fired and is waiting to be deliveredvolatile cyg_bool sigalrm_pending = false;//==========================================================================// Implementation functions.// These are where the real work of the signal mechanism gets done.externC void cyg_posix_signal_start(){    // Chain all free signal_info objects together    for( int i = 0; i < SIGQUEUE_MAX; i++ )    {        siginfo[i].next = siginfo_next;        siginfo_next = &siginfo[i];    }        // initialize all signal actions to SIG_DFL    for ( unsigned int i=0; i<(sizeof(sigstate)/sizeof(signal_state)); i++ )    {        sigstate[i].sa.sa_handler = SIG_DFL;    }    // Clear the pending signal set    sigemptyset( &sig_pending );}// -------------------------------------------------------------------------// Generate a signalcyg_bool cyg_sigqueue( const struct sigevent *sev, int code,                       pthread_info *thread ){    if( sev->sigev_notify == SIGEV_NONE )    {        // Do nothing        return true;    }    if( sev->sigev_notify == SIGEV_THREAD )    {        // create a thread to run the notification        // function.        // FIXME: implement SIGEV_THREAD        return true;    }    // Otherwise we must have a SIGEV_SIGNAL notification    // Find out whether the current thread already has the mutex    // locked. This is a distinct possibility if this function is    // called from the ASR while exiting the signal_sigwait condvar in    // pause() and sigtimedwait().        pthread_info *self = pthread_self_info();    cyg_bool locked = (self != NULL) && (signal_mutex.get_owner() == self->thread);        // Lock the mutex only if we do not already own it    if( !locked ) signal_mutex.lock();        int signo = sev->sigev_signo;    signal_state *ss = &sigstate[signo];    if( ss->sa.sa_flags & SA_SIGINFO )    {        // We have a queuable signal, allocate a signal_info        // object and add it to the queue.        if( siginfo_next == NULL )        {            if( !locked ) signal_mutex.unlock();            return false;        }        signal_info *si = siginfo_next;        siginfo_next = si->next;        si->si.si_signo = signo;        si->si.si_code = code;        si->si.si_value = sev->sigev_value;        if( ss->pending == NULL )        {            si->next = si;        }        else        {            si->next = ss->pending->next;            ss->pending->next = si;        }                    ss->pending = si;    }    // else A non-queuable signal, just set it pending    if( thread != NULL )    {        sigaddset( &thread->sigpending, signo );        // just wake the thread up now if it's blocked somewhere        if ((thread->sigpending & ~thread->sigmask) != 0)        {            thread->thread->set_asr_pending();            thread->thread->release();        }    }    else    {        sigaddset( &sig_pending, signo );        // Wake up any threads in sigsuspend() and sigwait().        if (!signal_sigwait.get_queue()->empty())        {            signal_sigwait.broadcast();        }         else        {            cyg_posix_pthread_release_thread( &sig_pending );        }    }    if( !locked ) signal_mutex.unlock();        return true;}// -------------------------------------------------------------------------// Deliver any pending unblocked signals to the current thread// Returns true if a signal handler was called.cyg_bool cyg_deliver_signals(){    cyg_bool res = false;        pthread_info *self = pthread_self_info();    // If there is no pthread_info pointer for this thread then    // it is not a POSIX thread and cannot have signals delivered    // to it.        if( self == NULL ) return false;        // If there are no pending signals our work is done    if( sig_pending == 0 && self->sigpending == 0 )        return false;    // If there are no unmasked pending signals our    // work is also done    if( ((sig_pending | self->sigpending) & ~self->sigmask) == 0 )        return false;    // As with cyg_sigqueue(), this function can get called from an    // ASR where the signal_mutex is already locked. Check here to    // avoid relocking...        cyg_bool locked = signal_mutex.get_owner() == self->thread;        if( !locked ) signal_mutex.lock();            sigset_t todo;    // Since a signal handler may raise another signal, or unmask an existing    // signal, we loop here while there are no more unblocked signals pending.    while( (todo = ((sig_pending | self->sigpending) & ~self->sigmask)) != 0 )    {        // Here todo is a mask of the signals available for delivery                int signo = 0;        // This prioritizes low numbered signals        HAL_LSBIT_INDEX( signo, todo );        signal_state *ss = &sigstate[signo];        sigset_t sigbit = 1L<<signo;        if( ss->sa.sa_handler != SIG_IGN )        {            sigset_t oldmask = self->sigmask;            siginfo_t lsi;            if(ss->pending != NULL)            {                // There is a queued signal. Dequeue it and copy the                // siginfo object to a local copy.                                signal_info *si = ss->pending->next;                                    // Make a local copy of the siginfo object                lsi = si->si;                                    // Remove the head signal_info object from the                // circular list.                 if( ss->pending == si )                    ss->pending = NULL;                else                    ss->pending->next = si->next;                // Return it to the free list                si->next = siginfo_next;                siginfo_next = si;            }            else            {                // There are no signals queued. Set up the local siginfo_t                // object with default values.                 lsi.si_signo = signo;                lsi.si_code = SI_USER;                lsi.si_value.sival_int = 0;            }                        // Clear the bit from the pending masks. If the pending            // queue is not empty, leave the bits set, otherwise clear            // them. Do this now so that if the signal handler longjumps            // out, the signal subsystem is clean.                    if( ss->pending == NULL )            {                // Clear the bit in both masks regardless of which                // one it actually came from. This is cheaper than                // trying to find out.                sig_pending &= ~sigbit;                self->sigpending &= ~sigbit;            }            // Add the mask set and the signal itself to the            // mask while we call the signal handler            self->sigmask = oldmask | ss->sa.sa_mask | sigbit;                        // Unlock now so that a longjmp out of the handler            // does the right thing. We do this even if we did not            // lock the mutex since it will only recently have been            // relocked and thus all data is still consistent.                            signal_mutex.unlock();                        if( ss->sa.sa_flags & SA_SIGINFO )            {                // A sigaction delivery                CYG_CHECK_FUNC_PTR( ss->sa.sa_sigaction,                                    "Bad sa_sigaction signal handler" );                ss->sa.sa_sigaction( signo, &lsi, NULL );            }            else if ( ss->sa.sa_handler == SIG_DFL )            {                CYG_TRACE2( true,                            "Unhandled POSIX signal: sig=%d, mask=%08x",                            signo, oldmask );                // FIXME: should do something better here#if CYGINT_ISO_EXIT                _exit( -signo );#endif                CYG_FAIL("Unhandled POSIX signal");            }                        else            {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产免费| 国产成人av影院| 欧美日韩一区二区三区在线| 一区av在线播放| 91精品午夜视频| 久久www免费人成看片高清| 久久久久久久综合色一本| 国产精品自拍网站| 亚洲免费电影在线| 欧美人与禽zozo性伦| 另类成人小视频在线| 国产午夜亚洲精品午夜鲁丝片| 成人永久免费视频| 一区二区三区免费网站| 欧美剧情片在线观看| 麻豆专区一区二区三区四区五区| 精品99一区二区| 色综合天天狠狠| 日本美女视频一区二区| 中文字幕成人在线观看| 欧美图区在线视频| 国产精品77777竹菊影视小说| 亚洲天堂网中文字| 欧美一级免费大片| 波多野结衣91| 美日韩一区二区| 亚洲免费观看高清完整版在线观看熊| 欧美裸体bbwbbwbbw| 国产aⅴ综合色| 天堂va蜜桃一区二区三区| 国产日韩视频一区二区三区| 91福利资源站| 国产69精品久久99不卡| 日欧美一区二区| 国产精品嫩草99a| 日韩一级高清毛片| av在线一区二区三区| 日韩电影一区二区三区四区| 中文字幕欧美日本乱码一线二线 | 国产精品久久久久久久浪潮网站| 色噜噜狠狠色综合欧洲selulu| 日本视频免费一区| 亚洲欧美经典视频| 国产日韩v精品一区二区| 欧美日韩在线观看一区二区| 国产凹凸在线观看一区二区| 免费成人美女在线观看.| 一区二区三区日韩精品视频| 国产日韩欧美精品综合| 91精品国模一区二区三区| av成人免费在线| www.成人在线| 精品欧美久久久| 欧美日韩在线三级| 91在线视频18| 不卡av在线网| 国产酒店精品激情| 美洲天堂一区二卡三卡四卡视频| 亚洲精品日韩一| 国产精品电影院| 欧美经典三级视频一区二区三区| 精品国产乱码久久久久久牛牛| 欧美日韩一区二区三区高清 | 99久久精品99国产精品 | 午夜精品久久久久久| 亚洲欧美一区二区久久| 欧美国产精品v| 国产视频一区二区在线| 2021国产精品久久精品| 精品久久免费看| 久久久久久久精| 久久精品亚洲麻豆av一区二区| 精品国产sm最大网站免费看| 日韩欧美成人一区二区| 欧美电影免费观看高清完整版| 欧美人妖巨大在线| 欧美一区二区播放| 欧美丰满高潮xxxx喷水动漫| 欧美日韩一区二区三区在线| 欧美日韩三级一区二区| 在线播放91灌醉迷j高跟美女 | 欧美亚洲动漫精品| 在线视频中文字幕一区二区| 91国偷自产一区二区开放时间 | 欧美日韩不卡视频| 欧美人动与zoxxxx乱| 在线成人免费视频| 日韩欧美一级特黄在线播放| 日韩精品一区二区三区四区| 久久久久99精品一区| 国产精品视频一二三| 国产精品福利影院| 亚洲综合久久av| 欧美aaaaaa午夜精品| 国产一区不卡精品| 91丨porny丨中文| 欧美日韩一区精品| 精品国产一区二区国模嫣然| 国产午夜一区二区三区| 日韩毛片一二三区| 午夜精品久久久久久| 国产一区在线不卡| 91浏览器入口在线观看| 9191成人精品久久| 中文字幕乱码日本亚洲一区二区 | 日韩一区在线看| 亚洲电影你懂得| 国产呦萝稀缺另类资源| jizz一区二区| 5566中文字幕一区二区电影| 国产三级精品视频| 亚洲一区二区在线免费观看视频| 日本不卡的三区四区五区| 床上的激情91.| 欧美日韩国产免费一区二区| 久久精品日产第一区二区三区高清版 | 日韩福利视频导航| 成人毛片老司机大片| 欧美日韩国产片| 国产精品无遮挡| 日本人妖一区二区| 一本色道久久综合亚洲精品按摩| 日韩视频免费直播| 亚洲欧美激情一区二区| 久久成人免费电影| 色噜噜狠狠色综合欧洲selulu| 精品日韩一区二区| 亚洲一二三四区不卡| 国产91精品露脸国语对白| 欧美另类一区二区三区| 国产精品久久精品日日| 九九国产精品视频| 欧美日韩在线播| 成人免费在线播放视频| 国产一区二区91| 91精品在线免费观看| 一区二区三区久久久| 成人国产精品免费观看| 日韩欧美一区二区视频| 一区二区三区欧美激情| 成人精品视频.| 精品美女在线播放| 日本美女视频一区二区| 欧美日韩精品欧美日韩精品一 | 欧美日韩和欧美的一区二区| 日本一区二区三区免费乱视频| 肉肉av福利一精品导航| 91国偷自产一区二区开放时间 | 在线欧美一区二区| 国产精品久久久久久久午夜片| 国产自产v一区二区三区c| 日韩精品中文字幕一区二区三区 | 欧美精品一区视频| 麻豆91免费观看| 337p亚洲精品色噜噜狠狠| 一区二区久久久久久| jlzzjlzz亚洲日本少妇| 国产精品毛片大码女人| 国产suv精品一区二区三区| 久久久国产精华| 国产精品亚洲专一区二区三区| 日韩免费成人网| 国产主播一区二区| 久久久久久久久岛国免费| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 亚洲三级久久久| 99热精品一区二区| 综合网在线视频| 91麻豆swag| 午夜久久久久久电影| 91精品国产综合久久蜜臀| 日韩高清在线不卡| 日韩三级在线观看| 国产一区二区三区日韩| 国产三级精品视频| 91一区二区三区在线观看| 亚洲欧美激情小说另类| 欧美日韩一区二区三区四区| 爽好多水快深点欧美视频| 91精选在线观看| 国产一区二区三区在线观看免费| 久久九九久精品国产免费直播| 国产91精品在线观看| 国产精品丝袜黑色高跟| 色婷婷综合久色| 91在线观看免费视频| 欧美精品99久久久**| 青娱乐精品视频在线| 欧美一区二区在线播放| 九一九一国产精品| 国产午夜三级一区二区三| 99久久国产综合精品麻豆 | 日韩主播视频在线| 精品国产伦一区二区三区观看体验| 国产精品乱码妇女bbbb| 91精品国产欧美一区二区18| 色综合久久久久| 国产呦萝稀缺另类资源| 日韩综合小视频| 亚洲影院免费观看|