Пример #1
0
/*{
** Name:	IIUGtagFree() -	Return a Tag and Memory for Re-use.
**
** Description:
**	Returns a tag block ID for re-use when it is no longer needed.
**	The memory associated with the tag is also freed.
**
**	This routine should be used wherever the following call sequence
**	would be:
**
**		FEfree( FEendtag() );
**
**	Instead:
**
**		IIUGtagFree( FEendtag() );
**
** History:
**	1-jun-1987 (Joe)
**		Initial Version
**	15-jun-1987 (Joe)
**		Made it call FEfree before returning tag.
**	7/93 (Mike S) Now use MEfreetag
**	8/93 (Mike S) New calling sequence for MEfreetag
*/
VOID
IIUGtagFree ( TAGID tag )
{
	if (FEfree(tag) == OK)
	{
	    /* If FEfree didn't find an entry, this is a bogus tag. */
	    (VOID) MEfreetag(tag);
	}
}
Пример #2
0
/*
** Name: WSMRemoveUsrSession() - remove a session from the hashtable and the timeout list.
**
** Description:
**
** Inputs:
**	USR_PSESSION*	: user session 
**
** Outputs:
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      03-Jun-1999 (fanra01)
**          Add removal of user session variable semaphore.
*/
GSTATUS 
WSMRemoveUsrSession ( 
    USR_PSESSION    session)
{
    GSTATUS err = GSTAT_OK;
    USR_PSESSION tmp;

    CLEAR_STATUS(WPSCleanFilesTimeout (session->name));

    CLEAR_STATUS(DDFdelhash(
                        usr_sessions,
                        session->name,
                        STlength(session->name),
                        (PTR*) &tmp));

    CLEAR_STATUS(WSMRemoveTimeout(session));

    if (session->requested_counter <= 0)
    {
        while (session->transactions != NULL)
            CLEAR_STATUS( WSMRollback(session->transactions, FALSE) );

        if (session->name != NULL)
            usr_sess_detach(session->name);

        if (session->userid != SYSTEM_ID)
            CLEAR_STATUS(DDSReleaseUser(session->userid));

        err = DDFSemOpen(&session->usrvarsem, TRUE);
        if (err == GSTAT_OK)
        {
            CLEAR_STATUS(WSFCleanVariable(session->vars));
            CLEAR_STATUS(DDFrmhash(&session->vars));
            CLEAR_STATUS(DDFSemClose(&session->usrvarsem));
        }
        CLEAR_STATUS(DDFSemDestroy(&session->usrvarsem));
        MEfreetag(session->mem_tag);
        MEfree((PTR)session);
    }
return(err);
}
Пример #3
0
/*
** Name: WSMReleaseActSession() - Clean an active session
**
** Description:
**
** Inputs:
**	ACT_PSESSION* : active session
**
** Outputs:
**	ACT_PSESSION* : active session
**
** Returns:
**	GSTATUS	:	GSTAT_OK
**
** Exceptions:
**	None
**
** Side Effects:
**	None
**
** History:
**      03-Jul-98 (fanra01)
**          Rename wts_sess_detach to act_sess_detach.
**      26-Aug-2003 (fanra01)
**          Removed explicit memory frees which are part of tagged memory
**          free.
*/
GSTATUS 
WSMReleaseActSession(
	ACT_PSESSION	*act_session) 
{
	GSTATUS err = GSTAT_OK;
	ACT_PSESSION session = *act_session;
	if (session != NULL)
	{
		*act_session = NULL;
		if (session->name != NULL)
			act_sess_detach(session->name);

		err = DDFSemOpen(&actSessSemaphore, TRUE);
		if (err == GSTAT_OK)
		{
			if (session->previous != NULL)
				session->previous->next = session->next;
			else
				active_sessions = session->next;

			if (session->next != NULL)
				session->next->previous = session->previous;
			CLEAR_STATUS(DDFSemClose(&actSessSemaphore));
		}

		CLEAR_STATUS( WSMCleanUserTimeout() );
		CLEAR_STATUS( WPSCleanFilesTimeout(NULL) );
		CLEAR_STATUS( DBCleanTimeout() );

		CLEAR_STATUS(WSFCleanVariable(session->vars));
		CLEAR_STATUS (DDFrmhash(&session->vars));
		MEfreetag(session->mem_tag);

		MEfree((PTR)session);
	}
return(err);
}