JosiahWI opened a new pull request, #13830:
URL: https://github.com/apache/trafficserver/pull/13830

   In this patch, the type of `ContinuationHandler` changes from a function 
pointer type to a struct containing a pointer to the handler and a pointer to 
an internal thunk that invokes the handler with the correct data type. This is 
a backwards-incompatible ABI change, exposed to plugins via `TSCont`.
   
   Additionally, this patch removes the constraint that `Continuation` must be 
listed as the first base class in multiple inheritance. As far as I can tell, 
that constraint was never required by the semantics, but was likely added 
because of a false positive GCC warning.
   
   This patch _does not_ provide a way for the event system to pass a strongly 
typed argument. The handler object accepts a `void*` as before, but casts it to 
the correct type before invoking the handler function.
   
   The new design has some similarities to the standard C++ function 
`std::mem_fn`. The return type of `std::mem_fn` is unspecified, so we cannot 
use that type here. The design also borrows functional programming terminology: 
a `thunk` is a deferred computation. In this context, the thunk is the deferred 
handler invocation.
   
   The previous code contained two bugs which are addressed in this patch:
   
   1) Calling a method through a different method type is is undefined behavior
   
   2) Comparing method pointers through the wrong type is undefined behavior
   
   TLDR: this patch makes it possible to use `int f(int, ExactType)` as an 
event handler without undefined behavior.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to