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:
@@ -104,14 +104,24 @@ intf_to_job ( struct interface *intf ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get destination job control interface
|
||||
* Get reference to destination job control interface
|
||||
*
|
||||
* @v job Job control interface
|
||||
* @ret dest Destination interface
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) struct job_interface *
|
||||
job_dest ( struct job_interface *job ) {
|
||||
return intf_to_job ( job->intf.dest );
|
||||
job_get_dest ( struct job_interface *job ) {
|
||||
return intf_to_job ( intf_get ( job->intf.dest ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop reference to job control interface
|
||||
*
|
||||
* @v job Job control interface
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
job_put ( struct job_interface *job ) {
|
||||
intf_put ( &job->intf );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user