Loading...
iokit/Kernel/IOEventSource.cpp xnu-3248.50.21 xnu-4903.231.4
--- xnu/xnu-3248.50.21/iokit/Kernel/IOEventSource.cpp
+++ xnu/xnu-4903.231.4/iokit/Kernel/IOEventSource.cpp
@@ -36,6 +36,7 @@
 
 #include <IOKit/IOEventSource.h>
 #include <IOKit/IOWorkLoop.h>
+#include <libkern/Block.h>
 
 #define super OSObject
 
@@ -162,6 +163,8 @@
 void IOEventSource::free( void )
 {
     IOStatisticsUnregisterCounter();
+
+	if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock);
 	
     if (reserved)
 		IODelete(reserved, ExpansionData, 1);
@@ -169,11 +172,39 @@
     super::free();
 }
 
-IOEventSource::Action IOEventSource::getAction () const { return action; };
+void IOEventSource::setRefcon(void *newrefcon)
+{
+	refcon = newrefcon;
+}
+
+void * IOEventSource::getRefcon() const
+{
+	return refcon;
+}
+
+IOEventSource::Action IOEventSource::getAction() const
+{
+	if (kActionBlock & flags) return NULL;
+	return (action);
+}
+
+IOEventSource::ActionBlock IOEventSource::getActionBlock(ActionBlock) const
+{
+	if (kActionBlock & flags) return actionBlock;
+	return (NULL);
+}
 
 void IOEventSource::setAction(Action inAction)
 {
+	if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock);
     action = inAction;
+}
+
+void IOEventSource::setActionBlock(ActionBlock block)
+{
+	if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock);
+	actionBlock = Block_copy(block);
+	flags |= kActionBlock;
 }
 
 IOEventSource *IOEventSource::getNext() const { return eventChainNext; };