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:
Michael Brown
2007-05-15 16:53:46 +00:00
parent 5471bfbbbe
commit b1755462ab
7 changed files with 96 additions and 38 deletions

View File

@@ -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 );
}