mirror of
https://github.com/ipxe/ipxe
synced 2026-01-01 00:07:27 +03:00
Do not hold self-references. This then avoids the problem of having to
ensure that we only drop our self-reference exactly once. To maintain the guarantee that an object won't go out of scope unexpectedly while one of its event handlers is being called, the event-calling functions now automatically obtain and drop extra references.
This commit is contained in:
@@ -34,7 +34,8 @@ struct interface {
|
||||
* @v intf Interface
|
||||
* @ret intf Interface
|
||||
*/
|
||||
static inline struct interface * intf_get ( struct interface *intf ) {
|
||||
static inline __attribute__ (( always_inline )) struct interface *
|
||||
intf_get ( struct interface *intf ) {
|
||||
ref_get ( intf->refcnt );
|
||||
return intf;
|
||||
}
|
||||
@@ -44,7 +45,8 @@ static inline struct interface * intf_get ( struct interface *intf ) {
|
||||
*
|
||||
* @v intf Interface
|
||||
*/
|
||||
static inline void intf_put ( struct interface *intf ) {
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
intf_put ( struct interface *intf ) {
|
||||
ref_put ( intf->refcnt );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user