]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOEventSource.cpp
xnu-4903.231.4.tar.gz
[apple/xnu.git] / iokit / Kernel / IOEventSource.cpp
index 3393993e0a286123748daf7a2e514cafb39f13d9..76c2d5032cf529bb7966bc102b133f3ef9908cdc 100644 (file)
@@ -36,6 +36,7 @@ HISTORY
 
 #include <IOKit/IOEventSource.h>
 #include <IOKit/IOWorkLoop.h>
 
 #include <IOKit/IOEventSource.h>
 #include <IOKit/IOWorkLoop.h>
+#include <libkern/Block.h>
 
 #define super OSObject
 
 
 #define super OSObject
 
@@ -162,6 +163,8 @@ bool IOEventSource::init(OSObject *inOwner,
 void IOEventSource::free( void )
 {
     IOStatisticsUnregisterCounter();
 void IOEventSource::free( void )
 {
     IOStatisticsUnregisterCounter();
+
+       if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock);
        
     if (reserved)
                IODelete(reserved, ExpansionData, 1);
        
     if (reserved)
                IODelete(reserved, ExpansionData, 1);
@@ -169,13 +172,41 @@ void IOEventSource::free( void )
     super::free();
 }
 
     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)
 {
 
 void IOEventSource::setAction(Action inAction)
 {
+       if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock);
     action = inAction;
 }
 
     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; };
 
 void IOEventSource::setNext(IOEventSource *inNext)
 IOEventSource *IOEventSource::getNext() const { return eventChainNext; };
 
 void IOEventSource::setNext(IOEventSource *inNext)