示例#1
0
/*
 *===========================================================================
 *                    ipcom_sysvar_init
 *===========================================================================
 * Description:
 * Parameters:
 * Returns:
 */
IP_STATIC Ip_err
ipcom_sysvar_init(void *ununsed)
{
    IPCOM_UNUSED_ARG(ununsed);

    ipcom_memset(&ipcom_sysvar, 0, sizeof(Ipcom_sysvar_data));
    return ipcom_mutex_create(&ipcom_sysvar.lock);
}
示例#2
0
/*
 *===========================================================================
 *                       ipppp_work_init
 *===========================================================================
 * Description:
 * Parameters:
 * Returns:
 *
 */
IP_STATIC Ip_err
ipppp_work_init(void *unused)
{
    IPCOM_UNUSED_ARG(unused);

    ipcom_list_init(&ipppp_work_queue);
    ipcom_mutex_create(&ipppp_work_lock);
    ipcom_sem_create(&ipppp_work_sem, 0);

    return ipcom_proc_create("ipppp_work",
                             (Ipcom_proc_func)ipppp_work,
                             IPCOM_PROC_STACK_DEFAULT,
                             IP_NULL);
}
/*
 *===========================================================================
 *                    ipcom_env_init
 *===========================================================================
 * Description:
 * Parameters:
 * Returns:
 */
IP_STATIC Ip_err
ipcom_env_init(void *procptr)
{
    Ipcom_proc   *proc = procptr;

    ip_assert(proc != IP_NULL);

    (void)ipcom_mutex_create(&proc->env_mutex);

    proc->env_tree = ipcom_hash_new((Ipcom_hash_obj_func)ipcom_env_hash_obj,
                                    (Ipcom_hash_key_func)ipcom_env_hash_key,
                                    (Ipcom_hash_cmp_func)ipcom_env_hash_cmp);
    ip_assert(proc->env_tree != IP_NULL);

    return IPCOM_SUCCESS;
}
/*
 *===========================================================================
 *                    ipcom_usr_create
 *===========================================================================
 * Description:
 * Parameters:
 * Returns:
 */
IP_PUBLIC Ip_err
ipcom_usr_create(void)
{
    Ip_err   err;

    /*!!RACE CONDITION*/
    if (ipcom_usr_created)
        return IPCOM_SUCCESS;
    ipcom_usr_created = IP_TRUE;

    err = ipcom_mutex_create(&ipcom_once_mutex);
    if (err != IPCOM_SUCCESS)
        goto fail;

    /****** SUCCESS *****/
    return err;


    /****** Create fail *****/
 fail:
    IP_PANIC();
    return err;
}