Ejemplo n.º 1
0
 // Pull an element from a list (if it's in one).
 ConditionVariable::Event* ConditionVariable::Event::Extract()
 {
     DCHECK(ValidateAsItem());
     if(!IsSingleton())
     {
         // Stitch neighbors together.
         next_->prev_ = prev_;
         prev_->next_ = next_;
         // Make extractee into a singleton.
         prev_ = next_ = this;
     }
     DCHECK(IsSingleton());
     return this;
 }
Ejemplo n.º 2
0
OSCondVarOld::Event *OSCondVarOld::Event::Extract()
{
    if (!IsSingleton())
    {
        next_->prev_ = prev_;
        prev_->next_ = next_;
        prev_ = next_ = this;
    }
    return this;
}
Ejemplo n.º 3
0
 ConditionVariable::Event::~Event()
 {
     if(0 == handle_)
     {
         // This is the list holder
         while(!IsEmpty())
         {
             Event* cv_event = PopFront();
             DCHECK(cv_event->ValidateAsItem());
             delete cv_event;
         }
     }
     DCHECK(IsSingleton());
     if(0 != handle_)
     {
         int ret_val = CloseHandle(handle_);
         DCHECK(ret_val);
     }
 }
Ejemplo n.º 4
0
 ConditionVariable::Event* ConditionVariable::Event::PopBack()
 {
     DCHECK(ValidateAsList());
     DCHECK(!IsSingleton());
     return prev_->Extract();
 }
Ejemplo n.º 5
0
 ConditionVariable::Event* ConditionVariable::Event::PopFront()
 {
     DCHECK(ValidateAsList());
     DCHECK(!IsSingleton());
     return next_->Extract();
 }
Ejemplo n.º 6
0
 // Methods for use on lists.
 bool ConditionVariable::Event::IsEmpty() const
 {
     DCHECK(ValidateAsList());
     return IsSingleton();
 }
Ejemplo n.º 7
0
UBOOL AfoGuard
    (LPPLLOCALVARS lpplLocalVars,       // Ptr to LocalVars
     LPTOKEN       lptkRhtArg)          // Ptr to right argument token
{
    APLSTYPE   aplTypeRht;          // Right arg storage type
    APLNELM    aplNELMRht;          // Right arg NELM
    APLRANK    aplRankRht;          // Right arg rank
    UBOOL      bRet;                // TRUE iff the result is valid
    APLLONGEST aplLongestRht;       // Right arg value if immediate

    // Get the right arg (Type, NELM, Rank)
    AttrsOfToken (lptkRhtArg, &aplTypeRht, &aplNELMRht, &aplRankRht, NULL);

    // Check for RIGHT RANK ERROR
    if (IsMultiRank (aplRankRht))
        goto RANK_EXIT;
    // Check for LENGTH ERROR
    if (!IsSingleton (aplNELMRht))
        goto LENGTH_EXIT;
    // Check for DOMAIN ERROR
    if (!IsNumeric (aplTypeRht))
        goto DOMAIN_EXIT;

    // Get and validate the first item in a token
    aplLongestRht = ValidateFirstItemToken (aplTypeRht, lptkRhtArg, &bRet);

    // Check for DOMAIN ERROR
    if (!bRet
     || !IsBooleanValue (aplLongestRht))
         goto DOMAIN_EXIT;

    // If the guard is FALSE, ...
    if (aplLongestRht EQ 0)
    {
        // If we're at the EOL, ...
        if (lpplLocalVars->lptkNext[-1].tkFlags.TknType EQ TKT_EOL)
            goto SYNTAX_EXIT;

        Assert (lpplLocalVars->lptkNext[-1].tkFlags.TknType EQ TKT_EOS);

        // Skip over the current stmt to the last token of the next stmt
        // When pl_yylex gets the next token it decrements this ptr first
        //   so that the next token it processes is an EOS/EOL which causes
        //   it to skip the next stmt.
        lpplLocalVars->lptkNext += lpplLocalVars->lptkNext[-1].tkData.tkIndex;

        // Save a ptr to the EOS/EOL token
        lpplLocalVars->lptkEOS = lpplLocalVars->lptkNext - 1;
    } // End IF

    goto NORMAL_EXIT;

RANK_EXIT:
    ErrorMessageIndirectToken (ERRMSG_RANK_ERROR APPEND_NAME,
                               lptkRhtArg);
    goto ERROR_EXIT;

LENGTH_EXIT:
    ErrorMessageIndirectToken (ERRMSG_LENGTH_ERROR APPEND_NAME,
                               lptkRhtArg);
    goto ERROR_EXIT;

DOMAIN_EXIT:
    ErrorMessageIndirectToken (ERRMSG_DOMAIN_ERROR APPEND_NAME,
                               lptkRhtArg);
    goto ERROR_EXIT;

SYNTAX_EXIT:
    ErrorMessageIndirectToken (ERRMSG_SYNTAX_ERROR APPEND_NAME,
                               lptkRhtArg);
    goto ERROR_EXIT;

ERROR_EXIT:
    // Mark as unsuccessful
    bRet = FALSE;
NORMAL_EXIT:
    return bRet;
} // End AfoGuard
Ejemplo n.º 8
0
bool OSCondVarOld::Event::IsEmpty() const
{
    return IsSingleton();
}