There's no point in having a separate opal_hotel_finalize() function
-- just move that functionality into the hotel destructor. This commit was SVN r27555.
Этот коммит содержится в:
родитель
92e197de73
Коммит
3d05c5cca3
@ -82,19 +82,6 @@ int opal_hotel_init(opal_hotel_t *h, int num_rooms,
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
int opal_hotel_finalize(opal_hotel_t *hotel)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Go through all occupied rooms and destroy their events */
|
||||
for (i = 0; i < hotel->num_rooms; ++i) {
|
||||
if (NULL != hotel->rooms[i].occupant) {
|
||||
opal_event_del(&(hotel->rooms[i].eviction_timer_event));
|
||||
}
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static void constructor(opal_hotel_t *h)
|
||||
{
|
||||
h->num_rooms = 0;
|
||||
@ -109,6 +96,15 @@ static void constructor(opal_hotel_t *h)
|
||||
|
||||
static void destructor(opal_hotel_t *h)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Go through all occupied rooms and destroy their events */
|
||||
for (i = 0; i < h->num_rooms; ++i) {
|
||||
if (NULL != h->rooms[i].occupant) {
|
||||
opal_event_del(&(h->rooms[i].eviction_timer_event));
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != h->rooms) {
|
||||
free(h->rooms);
|
||||
}
|
||||
|
@ -40,8 +40,11 @@
|
||||
* functionality. It is intended to be used in performance-critical
|
||||
* code paths -- extra functionality would simply add latency.
|
||||
*
|
||||
* There is an opal_hotel_init() function to create a hotel, and a
|
||||
* corresponding opal_hotel_finalize() function to destroy a hotel.
|
||||
* There is an opal_hotel_init() function to create a hotel, but no
|
||||
* corresponding finalize; the destructor will handle all finalization
|
||||
* issues. Note that when a hotel is destroyed, it will delete all
|
||||
* pending events from the event base (i.e., all pending eviction
|
||||
* callbacks); no further eviction callbacks will be invoked.
|
||||
*/
|
||||
|
||||
#ifndef OPAL_HOTEL_H
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user