/** Closes an event and frees the event structure. @param UserEvent Event to close @retval EFI_INVALID_PARAMETER Parameters are not valid. @retval EFI_SUCCESS The event has been closed **/ EFI_STATUS EFIAPI CoreCloseEvent ( IN EFI_EVENT UserEvent ) { EFI_STATUS Status; IEVENT *Event; Event = UserEvent; if (Event == NULL) { return EFI_INVALID_PARAMETER; } if (Event->Signature != EVENT_SIGNATURE) { return EFI_INVALID_PARAMETER; } // // If it's a timer event, make sure it's not pending // if ((Event->Type & EVT_TIMER) != 0) { CoreSetTimer (Event, TimerCancel, 0); } CoreAcquireEventLock (); // // If the event is queued somewhere, remove it // if (Event->RuntimeData.Link.ForwardLink != NULL) { RemoveEntryList (&Event->RuntimeData.Link); } if (Event->NotifyLink.ForwardLink != NULL) { RemoveEntryList (&Event->NotifyLink); } if (Event->SignalLink.ForwardLink != NULL) { RemoveEntryList (&Event->SignalLink); } CoreReleaseEventLock (); // // If the event is registered on a protocol notify, then remove it from the protocol database // CoreUnregisterProtocolNotify (Event); Status = CoreFreePool (Event); ASSERT_EFI_ERROR (Status); return Status; }
EFI_BOOTSERVICE EFI_STATUS EFIAPI CoreCloseEvent ( IN EFI_EVENT UserEvent ) /*++ Routine Description: Closes an event and frees the event structure. Arguments: UserEvent - Event to close Returns: EFI_INVALID_PARAMETER - Parameters are not valid. EFI_SUCCESS - The event has been closed --*/ { EFI_STATUS Status; IEVENT *Event; Event = UserEvent; if (Event == NULL) { return EFI_INVALID_PARAMETER; } if (Event->Signature != EVENT_SIGNATURE) { return EFI_INVALID_PARAMETER; } // // If it's a timer event, make sure it's not pending // if (Event->Type & EFI_EVENT_TIMER) { CoreSetTimer (Event, TimerCancel, 0); } CoreAcquireEventLock (); // // If the event is queued somewhere, remove it // if (Event->RuntimeData.Link.ForwardLink != NULL) { RemoveEntryList (&Event->RuntimeData.Link); } if (Event->NotifyLink.ForwardLink != NULL) { RemoveEntryList (&Event->NotifyLink); } if (Event->SignalLink.ForwardLink != NULL) { RemoveEntryList (&Event->SignalLink); } CoreReleaseEventLock (); // // If the event is registered on a protocol notify, // then remove it from the protocol database // CoreUnregisterProtocolNotify (Event); Status = CoreFreePool (Event); ASSERT_EFI_ERROR (Status); return Status; }