• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LE_FATAL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LE_FATAL函数的典型用法代码示例。如果您正苦于以下问题:C++ LE_FATAL函数的具体用法?C++ LE_FATAL怎么用?C++ LE_FATAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LE_FATAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: system

//--------------------------------------------------------------------------------------------------
static void LoadIpcBindingConfig
(
    void
)
{
    int result = system("sdir load");

    if (result == -1)
    {
        LE_FATAL("Failed to fork child process. (%m)");
    }
    else if (WIFEXITED(result))
    {
        int exitCode = WEXITSTATUS(result);

        if (exitCode != 0)
        {
            LE_FATAL("Couldn't load IPC binding config. `sdir load` exit code: %d.", exitCode);
        }
    }
    else if (WIFSIGNALED(result))
    {
        int sigNum = WTERMSIG(result);

        LE_FATAL("Couldn't load IPC binding config. `sdir load` received signal: %d.", sigNum);
    }
}
开发者ID:tegoo,项目名称:legato-af,代码行数:28,代码来源:frameworkDaemons.c


示例2: policy

// -------------------------------------------------------------------------------------------------
static void* ThreadMainFunction
(
    void* expectedPolicy  ///< The expected Linux scheduling policy (SCHED_IDLE or SCHED_OTHER).
)
// -------------------------------------------------------------------------------------------------
{
    LE_INFO("Checking scheduling policy...");

    int schedPolicy = sched_getscheduler(0);

    if (schedPolicy == -1)
    {
        LE_FATAL("Failed to fetch scheduling policy (error %d).", errno);
    }

    if (expectedPolicy != (void*)(size_t)schedPolicy)
    {
        LE_FATAL("Expected policy %p.  Got %p.", expectedPolicy, (void*)(size_t)schedPolicy);
    }
    else
    {
        LE_INFO("Policy correct.");
    }

    return NULL;
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:27,代码来源:priority.c


示例3: CONTAINER_OF

//--------------------------------------------------------------------------------------------------
void fa_event_TriggerEvent_NoLock
(
    event_PerThreadRec_t* portablePerThreadRecPtr
)
{
    static const uint64_t writeBuff = 1;    // Write the value 1 to increment the eventfd by 1.
    event_LinuxPerThreadRec_t* perThreadRecPtr =
        CONTAINER_OF(portablePerThreadRecPtr,
                     event_LinuxPerThreadRec_t,
                     portablePerThreadRec);

    ssize_t writeSize;

    for (;;)
    {
        writeSize = write(perThreadRecPtr->eventQueueFd, &writeBuff, sizeof(writeBuff));
        if (writeSize == sizeof(writeBuff))
        {
            return;
        }
        else
        {
            if ((writeSize == -1) && (errno != EINTR))
            {
                LE_FATAL("write() failed with errno %d.", errno);
            }
            else
            {
                LE_FATAL("write() returned %zd! (expected %zd)", writeSize, sizeof(writeBuff));
            }
        }
    }
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:34,代码来源:eventLoop.c


示例4: le_pm_Relax

//--------------------------------------------------------------------------------------------------
void le_pm_Relax(le_pm_WakeupSourceRef_t w)
{
    WakeupSource_t *ws, *entry;

    // Validate the reference, check if it exists
    ws = ToWakeupSource(w);
    // If the wakeup source is NULL then the client will have
    // been killed and we can just return
    if (NULL == ws)
        return;

    entry = (WakeupSource_t*)le_hashmap_Get(PowerManager.locks, ws->name);
    if (!entry)
        LE_FATAL("Wakeup source '%s' not created.\n", ws->name);

    if (!entry->taken) {
        LE_ERROR("Wakeup source '%s' already released.", entry->name);
        return;
    }

    // write to /sys/power/wake_unlock
    if (0 > write(PowerManager.wu, entry->name, strlen(entry->name)))
        LE_FATAL("Error releasing wakeup soruce '%s', errno = %d.",
            entry->name, errno);

    entry->taken = LE_OFF;

    return;
}
开发者ID:tegoo,项目名称:legato-af,代码行数:30,代码来源:le_pm.c


示例5: LE_FATAL

//--------------------------------------------------------------------------------------------------
static _ClientThreadData_t* InitClientThreadData
(
    const char* serviceInstanceName
)
{
    // Open a session.
    le_msg_ProtocolRef_t protocolRef;
    le_msg_SessionRef_t sessionRef;

    // The instance name must not be an empty string
    if ( serviceInstanceName[0] == '\0' )
    {
        LE_FATAL("Undefined client service instance name (Was StartClient() called?)");
    }

    protocolRef = le_msg_GetProtocolRef(PROTOCOL_ID_STR, sizeof(_Message_t));
    sessionRef = le_msg_CreateSession(protocolRef, serviceInstanceName);
    le_msg_SetSessionRecvHandler(sessionRef, ClientIndicationRecvHandler, NULL);
    le_msg_OpenSessionSync(sessionRef);

    // Store the client sessionRef in thread-local storage, since each thread requires
    // its own sessionRef.
    _ClientThreadData_t* clientThreadPtr = le_mem_ForceAlloc(_ClientThreadDataPool);
    clientThreadPtr->sessionRef = sessionRef;
    if (pthread_setspecific(_ThreadDataKey, clientThreadPtr) != 0)
    {
        LE_FATAL("pthread_setspecific() failed!");
    }

    return clientThreadPtr;
}
开发者ID:hakanernam,项目名称:legato-af,代码行数:32,代码来源:client.c


示例6: LE_DEBUG

//--------------------------------------------------------------------------------------------------
static void LoadECallSettings
(
    int32_t*  hMinAccuracyPtr,
    int32_t*  dirMinAccuracyPtr
)
{
    char psapStr[LE_MDMDEFS_PHONE_NUM_MAX_BYTES] = {0};

    LE_DEBUG("Start reading eCall app settings in Configuration Tree");

    le_cfg_IteratorRef_t eCallCfgRef = le_cfg_CreateReadTxn(CFG_ECALL_APP_PATH);

    // Get PSAP
    if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_PSAP))
    {
        if ( le_cfg_GetString(eCallCfgRef, CFG_NODE_PSAP, psapStr, sizeof(psapStr), "") != LE_OK )
        {
            LE_FATAL("No node value set for '%s', exit the app!", CFG_NODE_PSAP);
        }
        LE_DEBUG("eCall settings, PSAP number is %s", psapStr);
        if (le_ecall_SetPsapNumber(psapStr) != LE_OK)
        {
            LE_FATAL("Cannot set PSAP number, exit the app!");
        }
    }
    else
    {
        LE_FATAL("No value set for '%s', restart the app!", CFG_NODE_PSAP);
    }

    // Get minimum horizontal accuracy
    if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_H_MIN_ACCURACY))
    {
        *hMinAccuracyPtr = le_cfg_GetInt(eCallCfgRef, CFG_NODE_H_MIN_ACCURACY, DEFAULT_H_ACCURACY);
        LE_DEBUG("eCall app settings, horizontal accuracy is %d meter(s)", *hMinAccuracyPtr);
    }
    else
    {
        *hMinAccuracyPtr = DEFAULT_H_ACCURACY;
    }

    // Get minimum direction accuracy
    if (le_cfg_NodeExists(eCallCfgRef, CFG_NODE_DIR_MIN_ACCURACY))
    {
        *dirMinAccuracyPtr = le_cfg_GetInt(eCallCfgRef, CFG_NODE_DIR_MIN_ACCURACY, DEFAULT_DIR_ACCURACY);
        LE_DEBUG("eCall app settings, direction accuracy is %d degree(s)", *dirMinAccuracyPtr);
    }
    else
    {
        *dirMinAccuracyPtr = DEFAULT_DIR_ACCURACY;
    }

    le_cfg_CancelTxn(eCallCfgRef);
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:55,代码来源:eCallApp.c


示例7: LE_ASSERT

//--------------------------------------------------------------------------------------------------
le_result_t pa_audioSimu_CheckAudioPathSet
(
    void
)
{
    le_audio_If_t inItf;
    le_audio_If_t outItf;

    for (inItf = 0; inItf < LE_AUDIO_NUM_INTERFACES; inItf++)
    {
        for (outItf = 0; outItf < LE_AUDIO_NUM_INTERFACES; outItf++)
        {
            if ( inItf == outItf )
            {
                // audio path can't be built between a stream and the same stream
                LE_ASSERT( BuildAudioPath[inItf][outItf] == 0 );
            }
            else if ( IS_OUTPUT_STREAM(inItf) )
            {
                // if the input stream is an output, it is not a valuable path
                LE_ASSERT( BuildAudioPath[inItf][outItf] == 0 );
            }
            else if ( IS_INPUT_STREAM(inItf) )
            {
                if ( IS_OUTPUT_STREAM(outItf) )
                {
                    // this is an expected audio path. It should be set only once
                    LE_ASSERT( BuildAudioPath[inItf][outItf] == 1 );
                }
                else if (IS_INPUT_STREAM(outItf))
                {
                    // if the output stream is an input, it is not a valuable path
                    LE_ASSERT( BuildAudioPath[inItf][outItf] == 0 );
                }
                else
                {
                    LE_FATAL("Unknown audio path");
                }
            }
            else
            {
                LE_FATAL("Unknown audio path");
            }
        }
    }

    return LE_OK;
}
开发者ID:legatoproject,项目名称:legato-PlatformAdaptor-Simu,代码行数:49,代码来源:pa_audio_simu.c


示例8: le_mem_ForceAlloc

//--------------------------------------------------------------------------------------------------
le_sem_Ref_t CreateSemaphore
(
    const char* nameStr,
    int         initialCount,
    bool        isTraceable
)
//--------------------------------------------------------------------------------------------------
{
    // Allocate a semaphore object and initialize it.
    Semaphore_t* semaphorePtr = le_mem_ForceAlloc(SemaphorePoolRef);
    semaphorePtr->semaphoreListLink = LE_DLS_LINK_INIT;
    semaphorePtr->waitingList = LE_DLS_LIST_INIT;
    pthread_mutex_init(&semaphorePtr->waitingListMutex, NULL);  // Default attributes = Fast mutex.
    semaphorePtr->isTraceable = isTraceable;
    if (le_utf8_Copy(semaphorePtr->nameStr, nameStr, sizeof(semaphorePtr->nameStr), NULL) == LE_OVERFLOW)
    {
        LE_WARN("Semaphore name '%s' truncated to '%s'.", nameStr, semaphorePtr->nameStr);
    }

    // Initialize the underlying POSIX semaphore shared between thread.
    int result = sem_init(&semaphorePtr->semaphore,0, initialCount);
    if (result != 0)
    {
        LE_FATAL("Failed to set the semaphore . errno = %d (%m).", errno);
    }

    // Add the semaphore to the process's Semaphore List.
    LOCK_SEMAPHORE_LIST();
    le_dls_Queue(&SemaphoreList, &semaphorePtr->semaphoreListLink);
    UNLOCK_SEMAPHORE_LIST();

    return semaphorePtr;
}
开发者ID:tegoo,项目名称:legato-af,代码行数:34,代码来源:semaphores.c


示例9: sem_trywait

//--------------------------------------------------------------------------------------------------
le_result_t le_sem_TryWait
(
    le_sem_Ref_t    semaphorePtr   ///< [IN] Pointer to the semaphore
)
{
//     TODO: Implement this.
//     if (semaphorePtr->isTraceable)
//     {
//     }
//     else
    {
        int result;

        result = sem_trywait(&semaphorePtr->semaphore);

        if (result != 0)
        {
            if ( errno == EAGAIN ) {
                return LE_WOULD_BLOCK;
            } else {
                LE_FATAL("Thread '%s' failed to trywait on semaphore '%s'. Error code %d (%m).",
                        le_thread_GetMyName(),
                        semaphorePtr->nameStr,
                        result);
            }
        }
    }

    return LE_OK;
}
开发者ID:tegoo,项目名称:legato-af,代码行数:31,代码来源:semaphores.c


示例10: SigUser2Handler

static void SigUser2Handler(int sigNum)
{
    LE_INFO("%s received through fd handler.", strsignal(sigNum));

    switch (checkCount)
    {
        case 2:
        {
            // Send to the other thread.  But the other thread should not get it.
            checkCount++;
            LE_ASSERT(kill(getpid(), SIGUSR1) == 0);

            // Make sure that the signal to thread 1 is sent first.
            sleep(1);

            // Send to ourself and we should get it
            checkCount++;
            LE_ASSERT(kill(getpid(), SIGUSR2) == 0);

            break;
        }

        case 4:
        {
            LE_INFO("======== Signal Events Test Completed (PASSED) ========");
            exit(EXIT_SUCCESS);
        }

        default: LE_FATAL("Should not be here.");
    }
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:31,代码来源:signalEventsTest.c


示例11: main

int main(int argc, char* argv[])
{
    arg_SetArgs((size_t)argc, (char**)argv);

    LE_DEBUG("== Starting Executable '%s' ==", STRINGIZE(LE_EXECUTABLE_NAME));

    LE_LOG_SESSION = log_RegComponent( STRINGIZE(LE_COMPONENT_NAME), &LE_LOG_LEVEL_FILTER_PTR);

    // Connect to the Log Control Daemon.
    // The sooner we can connect to the Log Control Daemon, the better, because that is when
    // we obtain any non-default log settings that have been set using the interactive log
    // control tool.  However, we can't do that until we have a working IPC messaging system.
    // However, the Log Control Daemon shouldn't try to connect to itself.
    // Also, the Service Directory shouldn't try to use the messaging system, so it can't
    // connect to the Log Control Daemon either.  Besides, the Service Directory starts before
    // the Log Control Daemon starts.
    #ifndef NO_LOG_CONTROL
        log_ConnectToControlDaemon();
    #endif

    //@todo: Block all signals that the user intends to handle with signal events.

    // Queue up all the component initialization functions to be called by the Event Loop after
    // it processes any messages that were received from the Log Control Daemon.
    event_QueueComponentInit(_le_event_InitializeComponent);


    LE_DEBUG("== Starting Event Processing Loop ==");

    le_event_RunLoop();

    LE_FATAL("SHOULDN'T GET HERE!");
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:33,代码来源:_le_main.c


示例12: memset

//--------------------------------------------------------------------------------------------------
void msgService_SendServiceId
(
    le_msg_ServiceRef_t serviceRef, ///< [in] Pointer to the service whose ID is to be sent.
    int                 socketFd    ///< [in] File descriptor of the connected socket to send on.
)
//--------------------------------------------------------------------------------------------------
{
    svcdir_ServiceId_t serviceId;

    memset(&serviceId, 0, sizeof(serviceId));

    serviceId.maxProtocolMsgSize = le_msg_GetProtocolMaxMsgSize(serviceRef->id.protocolRef);

    le_utf8_Copy(serviceId.protocolId,
                 le_msg_GetProtocolIdStr(serviceRef->id.protocolRef),
                 sizeof(serviceId.protocolId),
                 NULL);

    le_utf8_Copy(serviceId.serviceName,
                 serviceRef->id.name,
                 sizeof(serviceId.serviceName),
                 NULL);

    le_result_t result = unixSocket_SendDataMsg(socketFd, &serviceId, sizeof(serviceId));
    if (result != LE_OK)
    {
        LE_FATAL("Failed to send. Result = %d (%s)", result, LE_RESULT_TXT(result));
    }
    // NOTE: This is only done when the socket is newly opened, so this shouldn't ever
    //       return LE_NO_MEMORY to indicate send buffers being full.
}
开发者ID:andreasanna,项目名称:legato-af,代码行数:32,代码来源:messagingService.c


示例13: main

int main(int argc, char** argv)
{
    struct pollfd pollControl;

    le_sms_ConnectService();

    // Register a callback function to be called when an SMS arrives.
    (void)le_sms_AddRxMessageHandler(SmsRxHandler, NULL);

    printf("Waiting for SMS messages to arrive...\n");

    // Get the Legato event loop "readyness" file descriptor and put it in a pollfd struct
    // configured to detect "ready to read".
    pollControl.fd = le_event_GetFd();
    pollControl.events = POLLIN;

    while (true)
    {
        // Block until the file descriptor is "ready to read".
        int result = poll(&pollControl, 1, -1);

        if (result > 0)
        {
            // The Legato event loop needs servicing. Keep servicing it until there's nothing left.
            while (le_event_ServiceLoop() == LE_OK)
            {
                /* le_event_ServiceLoop() has more to do.  Need to call it again. */
            }
        }
        else
        {
            LE_FATAL("poll() failed with errno %m.");
        }
    }
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:35,代码来源:main.c


示例14: pthread_getspecific

//--------------------------------------------------------------------------------------------------
void StopClient
(
    void
)
{
    _ClientThreadData_t* clientThreadPtr = pthread_getspecific(_ThreadDataKey);

    // If the thread specific data is NULL, then there is no current client session.
    if (clientThreadPtr == NULL)
    {
        LE_ERROR("Trying to stop non-existent client session for '%s' service",
                 GlobalServiceInstanceName);
    }
    else
    {
        le_msg_CloseSession( clientThreadPtr->sessionRef );

        // Need to delete the thread specific data, since it is no longer valid.  If a new
        // client session is started, new thread specific data will be allocated.
        le_mem_Release(clientThreadPtr);
        if (pthread_setspecific(_ThreadDataKey, NULL) != 0)
        {
            LE_FATAL("pthread_setspecific() failed!");
        }

        LE_DEBUG("======= Stopping Client %s ========", GlobalServiceInstanceName);
    }
}
开发者ID:hakanernam,项目名称:legato-af,代码行数:29,代码来源:client.c


示例15: LE_FATAL

//--------------------------------------------------------------------------------------------------
le_result_t le_clk_ConvertToUTCString
(
    le_clk_Time_t time,            ///< [IN]  date/time to convert
    const char* formatSpecStrPtr,  ///< [IN]  Format specifier string, using conversion
                                   ///        specifiers defined for strftime().
    char*   destStrPtr,            ///< [OUT] Destination for the formatted date/time string
    size_t  destSize,              ///< [IN]  Size of the destination buffer in bytes.
    size_t* numBytesPtr            ///< [OUT] Number of bytes copied, not including NULL-terminator.
                                   ///        Parameter can be set to NULL if the number of
                                   ///        bytes copied is not needed.

)
{
    struct tm brokenTime;
    le_result_t result;

    if (gmtime_r(&time.sec, &brokenTime) == NULL)
    {
        LE_FATAL("Cannot convert time into UTC broken down time.");
    }

    result = FormatBrokenTime(time, brokenTime, formatSpecStrPtr, destStrPtr, destSize, numBytesPtr);

    return result;
}
开发者ID:H-H-bin,项目名称:legato-af,代码行数:26,代码来源:clock.c


示例16: TRACE

//--------------------------------------------------------------------------------------------------
static void StopMonitoringFd
(
    FdMonitor_t* fdMonitorPtr
)
//--------------------------------------------------------------------------------------------------
{
    TRACE("Deleting fd %d (%s) from thread's epoll set.",
          fdMonitorPtr->fd,
          fdMonitorPtr->name);

    if (epoll_ctl(fdMonitorPtr->threadRecPtr->epollFd, EPOLL_CTL_DEL, fdMonitorPtr->fd, NULL) == -1)
    {
        if (errno == EBADF)
        {
            TRACE("epoll_ctl(DEL) for fd %d resulted in EBADF.  Probably because connection"
                  " closed before deleting FD Monitor %s.",
                  fdMonitorPtr->fd,
                  fdMonitorPtr->name);
        }
        else if (errno == ENOENT)
        {
            TRACE("epoll_ctl(DEL) for fd %d resulted in ENOENT.  Probably because we stopped"
                  " monitoring before deleting the FD Monitor %s.",
                  fdMonitorPtr->fd,
                  fdMonitorPtr->name);
        }
        else
        {
            LE_FATAL("epoll_ctl(DEL) failed for fd %d. errno = %d (%m)",
                     fdMonitorPtr->fd,
                     errno);
        }
    }
}
开发者ID:mbarazzouq,项目名称:legato-af,代码行数:35,代码来源:fdMonitor.c


示例17: switch

//--------------------------------------------------------------------------------------------------
const char* GetFdEventTypeName
(
    le_event_FdEventType_t eventType
)
//--------------------------------------------------------------------------------------------------
{
    switch (eventType)
    {
        case LE_EVENT_FD_READABLE:

            return "readable";

        case LE_EVENT_FD_READABLE_URGENT:

            return "readable-urgent";

        case LE_EVENT_FD_WRITEABLE:

            return "writeable";

        case LE_EVENT_FD_WRITE_HANG_UP:

            return "write-hangup";

        case LE_EVENT_FD_READ_HANG_UP:

            return "read-hangup";

        case LE_EVENT_FD_ERROR:

            return "error";
    }

    LE_FATAL("Unknown event type %d.", eventType);
}
开发者ID:mbarazzouq,项目名称:legato-af,代码行数:36,代码来源:fdMonitor.c


示例18: LE_FATAL

//--------------------------------------------------------------------------------------------------
static void* PThreadStartRoutine
(
    void* threadObjPtr
)
{
    void* returnValue;
    ThreadObj_t* threadPtr = threadObjPtr;

    // WARNING: This code must be very carefully crafted to avoid the possibility of hitting
    //          a cancellation point before pthread_cleanup_push() is called.  Otherwise, it's
    //          possible that any destructor function set before the thread was started will
    //          not get executed, which could create intermittent resource leaks.

    // Store the Thread Object pointer in thread-local storage so GetCurrentThreadPtr() can
    // find it later.
    // NOTE: pthread_setspecific() is not a cancellation point.
    if (pthread_setspecific(ThreadLocalDataKey, threadPtr) != 0)
    {
        LE_FATAL("pthread_setspecific() failed!");
    }

    // Push the default destructor onto the thread's cleanup stack.
    pthread_cleanup_push(CleanupThread, threadPtr);

    // Perform thread specific init
    thread_InitThread();

    // Call the user's main function.
    returnValue = threadPtr->mainFunc(threadPtr->context);

    // Pop the default destructor and call it.
    pthread_cleanup_pop(1);

    return returnValue;
}
开发者ID:mbarazzouq,项目名称:legato-af,代码行数:36,代码来源:thread.c


示例19: snprintf

//--------------------------------------------------------------------------------------------------
static void CaptureDebugData
(
    proc_Ref_t procRef,             ///< [IN] The process reference.
    bool isRebooting                ///< [IN] Is the supervisor going to reboot the system?
)
{
    char command[LIMIT_MAX_PATH_BYTES];
    int s = snprintf(command,
                     sizeof(command),
                     "saveLogs %s %s %s %s",
                     app_GetIsSandboxed(procRef->appRef) ? "SANDBOXED" : "NOTSANDBOXED",
                     app_GetName(procRef->appRef),
                     procRef->name,
                     isRebooting ? "REBOOT" : "");

    if (s >= sizeof(command))
    {
        LE_FATAL("Could not create command, buffer is too small.  "
                 "Buffer is %zd bytes but needs to be %d bytes.",
                 sizeof(command),
                 s);
    }

    int r = system(command);

    if (!WIFEXITED(r))
    {
        LE_ERROR("Could not backup core files.");
    }
}
开发者ID:tegoo,项目名称:legato-af,代码行数:31,代码来源:proc.c


示例20: le_mem_ForceAlloc

//--------------------------------------------------------------------------------------------------
event_PerThreadRec_t* fa_event_CreatePerThreadInfo
(
    void
)
{
    event_LinuxPerThreadRec_t* recPtr = le_mem_ForceAlloc(PerThreadPool);

    // Create the epoll file descriptor for this thread.  This will be used to monitor for
    // events on various file descriptors.
    recPtr->epollFd = epoll_create1(0);
    LE_FATAL_IF(recPtr->epollFd < 0, "epoll_create1(0) failed with errno %d.", errno);

    // Open an eventfd for this thread.  This will be uses to signal to the epoll fd that there
    // are Event Reports on the Event Queue.
    recPtr->eventQueueFd = eventfd(0, 0);
    LE_FATAL_IF(recPtr->eventQueueFd < 0, "eventfd() failed with errno %d.", errno);

    // Add the eventfd to the list of file descriptors to wait for using epoll_wait().
    struct epoll_event ev;
    memset(&ev, 0, sizeof(ev));
    ev.events = EPOLLIN | EPOLLWAKEUP;
    ev.data.ptr = NULL;     // This being set to NULL is what tells the main event loop that this
                            // is the Event Queue FD, rather than another FD that is being
                            // monitored.
    if (epoll_ctl(recPtr->epollFd, EPOLL_CTL_ADD, recPtr->eventQueueFd, &ev) == -1)
    {
        LE_FATAL(   "epoll_ctl(ADD) failed for fd %d. errno = %d",
                    recPtr->eventQueueFd,
                    errno);
    }

    return &recPtr->portablePerThreadRec;
}
开发者ID:legatoproject,项目名称:legato-af,代码行数:34,代码来源:eventLoop.c



注:本文中的LE_FATAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LE_FATAL_IF函数代码示例发布时间:2022-05-30
下一篇:
C++ LE_FAILURE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap