Re: [edk2] Regarding CreateEvent and CloseEvent.

Subject: Re: [edk2] Regarding CreateEvent and CloseEvent.

From: Sivakumar Subramani <Sivakumar.Subramani@exar.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2010-10-19 17:46:18

Hi Mike,
 
Thanks for Reply.
 
Yesterday I try adding SetTimer as below before calling CloseEvent. I will try to print the return status of both the SetTimer and CloseEvent, which should give some more details.
 
 gBS->SetTimer(nic->Dte_chk_timerevent, TimerCancel, 0);
 gBS->CloseEvent(nic->Dte_chk_timerevent);
Thanks,
~Siva
 

From: Kinney, Michael D [michael.d.kinney@intel.com]
Sent: Tuesday, October 19, 2010 9:42 AM
To: edk2-devel@lists.sourceforge.net
Cc: Leonid Grossman; Ramkrishna Vepa; Masroor Vettuparambil; Gopalcheti, Manoj
Subject: Re: [edk2] Regarding CreateEvent and CloseEvent.

Siva,

 

Yes.  CloseEvent() should cancel the timer.

 

Line 669 of MdeModulePkg/Core/Dxe/Event/Event.c has the following logic:

 

  //

  // If it's a timer event, make sure it's not pending

  //

  if ((Event->Type & EVT_TIMER) != 0) {

    CoreSetTimer (Event, TimerCancel, 0);

  }

 

 

Have you checked the return status from CloseEvent().  Maybe it is an incorrect event parameter.

 

Mike

 


From: Sivakumar Subramani [mailto:Sivakumar.Subramani@exar.com]
Sent: Monday, October 18, 2010 4:53 PM
To: edk2-devel@lists.sourceforge.net
Cc: Leonid Grossman; Ramkrishna Vepa; Masroor Vettuparambil; Gopalcheti, Manoj
Subject: [edk2] Regarding CreateEvent and CloseEvent.

 

Hi All,

 

I am trying to implement a polling function in my driver. So I used CreateEvent and SetTimer function. In SetTimer, I used TimerPeriodic type.

 

When I do device  reset, I do not want to have this poll function running, So I call CloseEvent function before starting device reset. Even after calling CloseEvent, I could see that Timer handler function is getting trigged.

 

Is it not that CloseEvent should delete the Timer object and make sure that timer handler function is scheduled further? Or Is there any way to make sure the timer handler function is not trigged after calling CloseEvent?

 

Thanks,
~Siva