Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Driver Completion-Routine causes kernel panic



Lance --

// *** SETUP FOR COMPLETION CALL ***
// -----------------------------------------------------------
// static array of original completion routine struct contents
sSavedStorageCompletion[mStorageCompletionIndex] = completion;

// save off IOMemoryDescriptor* from original read-call args
sIOMDBuffers[mStorageCompletionIndex] = buffer;

// substitute local completion address into struct
completion.action = MyStorageCompletion; // call here when done
completion.target = (void*) this; // pass in ptr to this obj
completion.parameter = (void*)(mStorageCompletionIndex); // index to saved data
mStorageCompletionIndex++; // maintain index for use with next call
if( mStorageCompletionIndex >= kIOStorageCompletionMax)
mStorageCompletionIndex = 0;

If you don't do this part under a lock, you aren't thread-safe...

-- Chris

------------------
6 Infinite Loop
M/S 306-2MS
Cupertino CA 95014
phone: (408) 974-4033
fax:   (408) 862-7577
email: email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden
References: 
 >Driver Completion-Routine causes kernel panic (From: Lance Drake <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.