summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/job.h
diff options
context:
space:
mode:
authorMichael Brown2007-05-15 18:53:46 +0200
committerMichael Brown2007-05-15 18:53:46 +0200
commitb1755462ab344ff758c3a1e6ae0d10a729d96d1b (patch)
tree858bb7ba3d439be957f6b9530a0040b26c49f3f2 /src/include/gpxe/job.h
parentData-transfer interface should now be functionally complete. (diff)
downloadipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.tar.gz
ipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.tar.xz
ipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.zip
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.
Diffstat (limited to 'src/include/gpxe/job.h')
-rw-r--r--src/include/gpxe/job.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/include/gpxe/job.h b/src/include/gpxe/job.h
index 2b33408fa..28885869c 100644
--- a/src/include/gpxe/job.h
+++ b/src/include/gpxe/job.h
@@ -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 );
}
/**