Add an oh-so-slightly faster variant of the hotel "checkin" action
(since this is used in the fast path) for when you ''know'' that there will be a room available: * Don't do the last_unoccupied_room check * Return void This commit was SVN r28757.
Этот коммит содержится в:
родитель
baa3182794
Коммит
bdb45a2e4f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -193,6 +193,27 @@ static inline int opal_hotel_checkin(opal_hotel_t *hotel,
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as opal_hotel_checkin(), but slightly optimized for when the
|
||||
* caller *knows* that there is a room available.
|
||||
*/
|
||||
static inline void opal_hotel_checkin_with_res(opal_hotel_t *hotel,
|
||||
void *occupant,
|
||||
int *room_num)
|
||||
{
|
||||
opal_hotel_room_t *room;
|
||||
|
||||
/* Put this occupant into the first empty room that we have */
|
||||
*room_num = hotel->unoccupied_rooms[hotel->last_unoccupied_room--];
|
||||
room = &(hotel->rooms[*room_num]);
|
||||
assert(room->occupant == NULL);
|
||||
room->occupant = occupant;
|
||||
|
||||
/* Assign the event and make it pending */
|
||||
opal_event_add(&(room->eviction_timer_event),
|
||||
&(hotel->eviction_timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the specified occupant out of the hotel.
|
||||
*
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user