The Sock->Lock is defined to protect the sharing data in socket. An access to 
socket interface will acquire the lock at the beginning and release the lock at 
the end.
In your case, would you please describe the “callback finishes” more detail? Do 
you mean the “callback” includes a Tcp4->Transmit() call and you need wait for 
this call finish before entering Tcp4->Receive()?

Best Regards,
Ye Ting

From: Thomas Rognon [mailto:tcrog...@gmail.com]
Sent: Thursday, August 21, 2014 9:12 AM
To: edk2-devel
Subject: [edk2] Asynchronous TCP issue

I have a driver that needs to do async TCP in the background while other UEFI 
apps are running. The flow needs to go like this:

{
  Tcp4->Accept(); // async
}

AcceptCallback() {
  Tcp4->Transmit(); // async
}

TransmitCallback() {
  Tcp4->Receive(); // async
}

This works up until Tcp4->Receive() which immediately returns 
EFI_ACCESS_DENIED. I traced it back to Status = EfiAcquireLockOrFail 
(&(Sock->Lock)); in SockRcv().

So the socket is locked while in the callback, which is very inconvenient. I 
worked around it by setting a timer to call Tcp4->Receive() a few milliseconds 
later. That way the callback finishes and the socket's lock is released before 
my code is run. I'd rather not do it that way, though.

Is this intended?  Thank you for any insight.

Thomas Rognon
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to