+#if DEBUG || DEVELOPMENT
+ char currentName[MAXTHREADNAMESIZE];
+ char newName[MAXTHREADNAMESIZE];
+ OSObject * obj;
+ OSString * str;
+ OSDictionary * dict;
+
+ currentName[0] = '\0';
+ if (thread_has_thread_name(current_thread())) {
+ dict = matching;
+ obj = matching->getObject(gIOPropertyMatchKey);
+ if ((dict = OSDynamicCast(OSDictionary, obj))) {
+ OSObject * result __block = NULL;
+ dict->iterateObjects(^bool (const OSSymbol * sym, OSObject * value) {
+ result = __DECONST(OSObject *, sym);
+ return true;
+ });
+ obj = result;
+ }
+ if (!obj) {
+ obj = matching->getObject(gIOResourceMatchKey);
+ }
+ if (!obj) {
+ obj = matching->getObject(gIONameMatchKey);
+ }
+ if (!obj) {
+ obj = matching->getObject(gIOProviderClassKey);
+ }
+ if ((str = OSDynamicCast(OSString, obj))) {
+ thread_get_thread_name(current_thread(), currentName);
+ snprintf(newName, sizeof(newName), "Waiting_'%s'", str->getCStringNoCopy());
+ thread_set_thread_name(current_thread(), newName);
+ }
+ }
+#endif /* DEBUG || DEVELOPMENT */
+