Пример #1
0
static ompi_mtl_portals_event_t*
ompi_mtl_portals_search_unex_q( ptl_match_bits_t match_bits,
                                ptl_match_bits_t ignore_bits )
{
    opal_list_item_t *list_item;
    ompi_mtl_portals_event_t *recv_event = NULL;

    /* check the queue of processed unexpected messages */
    list_item = opal_list_get_first(&ompi_mtl_portals.unexpected_messages);
    while (list_item != opal_list_get_end(&ompi_mtl_portals.unexpected_messages)) {
        opal_list_item_t *next_item = opal_list_get_next(list_item);

        recv_event = (ompi_mtl_portals_event_t*) list_item;
        if (CHECK_MATCH(recv_event->ev.match_bits, match_bits, ignore_bits)) {
            /* we have a match... */
            if ( false == recv_event->is_complete) {
                /* wait for put end event */
                ompi_mtl_portals_wait_for_put_end(recv_event->ev.link);
            }
            opal_list_remove_item(&(ompi_mtl_portals.unexpected_messages),
                                  list_item);
            return recv_event;
        }
        list_item = next_item;
    }

    /* didn't find it */
    return NULL;
}
Пример #2
0
static ompi_mtl_portals_event_t*
ompi_mtl_portals_search_unex_events(ptl_match_bits_t match_bits,
                                    ptl_match_bits_t ignore_bits)
{
    ptl_event_t ev;
    int ret;

    /* check to see if there are any events in the unexpected event queue */ 
    while (true) {
        ret = PtlEQGet(ompi_mtl_portals.ptl_unexpected_recv_eq_h,&ev);
        if (PTL_OK == ret) {
            if (PTL_EVENT_PUT_START == ev.type) {
                ompi_free_list_item_t *item;
                ompi_mtl_portals_event_t *recv_event;

                OMPI_FREE_LIST_GET(&ompi_mtl_portals.event_fl, item, ret);
                recv_event = (ompi_mtl_portals_event_t*) item;
                recv_event->ev = ev;
                recv_event->is_complete = false;

               if (PTL_IS_SHORT_MSG(recv_event->ev.match_bits)) {
                    ompi_mtl_portals_recv_short_block_t *block =
                        recv_event->ev.md.user_ptr;
                    OPAL_THREAD_ADD32(&block->pending, 1);
               }
                if (CHECK_MATCH(recv_event->ev.match_bits, match_bits, ignore_bits)) {
                    /* the one we want */
                    ompi_mtl_portals_wait_for_put_end(recv_event->ev.link);
                    return recv_event; 
                } else {
                    /* not the one we want, so add it to the unex list */
                    opal_list_append(&(ompi_mtl_portals.unexpected_messages),
                                     (opal_list_item_t*) recv_event);
                }
            } else if (PTL_EVENT_PUT_END == ev.type) {
                /* can't be the one we want */
                ompi_mtl_portals_match_up_put_end(ev.link);
            } else {
                opal_output(fileno(stderr)," Unrecognised event type - %d - ompi_mtl_portals_search_unex_events : %d \n",ev.type,ret);
                abort();
            }
        } else if (PTL_EQ_EMPTY == ret) {
            break; 
        } else {
            opal_output(fileno(stderr)," Error returned in ompi_mtl_portals_search_unex_events from PtlEQWait : %d \n",ret);
            abort();
        }
    }

    return NULL;
}
Пример #3
0
// PatternMatchI
//------------------------------------------------------------------------------
void TestAString::PatternMatchI() const
{
    #define CHECK_MATCH( pat, str, match )              \
    {                                                   \
        AStackString<> string( str );                   \
        TEST_ASSERT( string.MatchesI( pat ) == match ); \
    }

    CHECK_MATCH( "*.cpp",   "File.cpp", true )
    CHECK_MATCH( "*",       "File.cpp", true )
    CHECK_MATCH( "File*.*", "File.cpp", true )
    CHECK_MATCH( "*.c*",    "File.cpp", true )
    CHECK_MATCH( "File.cpp","File.cpp", true )

    CHECK_MATCH( "*.cpp",   "File.CPP", true )
    CHECK_MATCH( "File*.*", "FILE.cpp", true )
    CHECK_MATCH( "*.c*",    "File.CPP", true )
    CHECK_MATCH( "File.cpp","file.cpp", true )

    CHECK_MATCH( "*.cpp",   "File.c",           false );
    CHECK_MATCH( "*.cpp",   "File.cpp~",        false );
    CHECK_MATCH( "*.cpp",   "File.cpp.notcpp",  false );
    CHECK_MATCH( "*.cpp",   "",                 false );

    #undef CHECK_MATCH
}