Exemple #1
0
/** fmRemoveEventHandler
 * \ingroup intApi
 *
 * \desc            Remove a local event handler from the list of handlers.
 *
 * \param[out]      delivery is a pointer to a pointer to a ''fm_localDelivery'' 
 *                  structure. If a delivery structure is found for the calling 
 *                  process then a pointer to it is returned.
 *
 * \return          FM_OK if successful.
 * \return          FM_ERR_NOT_FOUND if there is no delivery structure for
 *                  the calling process.
 *
 *****************************************************************************/
fm_status fmRemoveEventHandler(fm_localDelivery ** delivery)
{
    fm_status         err;
    fm_dlist_node *   node;
    fm_localDelivery *cur;
    fm_int            myProcessId;

    FM_LOG_ENTRY_API(FM_LOG_CAT_API, "delivery=%p\n", (void *) delivery);

    myProcessId = fmGetCurrentProcessId();

    err = fmCaptureLock(&fmRootApi->localDeliveryLock, FM_WAIT_FOREVER);

    if (err == FM_OK)
    {

        for ( node = FM_DLL_GET_FIRST( (&fmRootApi->localDeliveryThreads), head ) ;
             node != NULL ;
             node = FM_DLL_GET_NEXT(node, next) )
        {
            cur = (fm_localDelivery *) node->data;

            if (cur->processId == myProcessId)
            {
                break;
            }
        }

        if (node != NULL) 
        {
            fmDListRemove(&fmRootApi->localDeliveryThreads, node);
            *delivery = cur;
            fmRootApi->localDeliveryCount--;
        }
        else
        {
            err = FM_ERR_NOT_FOUND;
        }

        (void) fmReleaseLock(&fmRootApi->localDeliveryLock);


    }   /* end if (err == FM_OK) */

    FM_LOG_EXIT_API(FM_LOG_CAT_API, err);

}   /* end fmRemoveEventHandler */
Exemple #2
0
fm_status fmDListRemoveBegin(fm_dlist *list, void **dataPtr)
{
    fm_dlist_node *nnode;
    void *         data;

    nnode = FM_DLL_GET_FIRST(list, head);
    
    if (!nnode)
    {
        return FM_ERR_NO_MORE;
    }

    data = fmDListRemove(list, nnode);

    *dataPtr = data;

    return FM_OK;

}   /* end fmDListRemoveBegin */
Exemple #3
0
fm_status fmDListRemoveEnd(fm_dlist *list, void **dataPtr)
{
    fm_dlist_node *nnode;
    void *         data;

    nnode = FM_DLL_GET_LAST(list, tail);
    
    if (!nnode)
    {
        return FM_ERR_NO_MORE;
    }

    data = fmDListRemove(list, nnode);

    *dataPtr = data;

    return FM_OK;

}   /* end fmDListRemoveEnd */