void sd_threadExit() { thread_t *thread = thread_getCurrentThread(); thread->died = true; while(1) sd_yield(); }
void ioglued() { thread_setName(thread_getCurrentThread(), "ioglued"); __ioglued_modulesToStop = array_create(); spinlock_unlock(&__ioglued_lock); size_t size = sizeof(ioglued_modules) / sizeof(const char *); for(size_t i=0; i<size; i++) { const char *name = ioglued_modules[i]; io_module_t *module = io_moduleWithName(name); if(!module) dbg("ioglued: Failed to publish \"%s\"\n", name); } while(1) { spinlock_lock(&__ioglued_lock); if(array_count(__ioglued_modulesToStop) > 0) { array_t *copy = array_copy(__ioglued_modulesToStop); array_removeAllObjects(__ioglued_modulesToStop); spinlock_unlock(&__ioglued_lock); for(size_t i=0; i<array_count(copy); i++) { io_module_t *module = array_objectAtIndex(copy, i); spinlock_lock(&module->lock); if(!module->initialized) { __ioglued_addReferencelessModule(module); spinlock_unlock(&module->lock); continue; } spinlock_unlock(&module->lock); io_moduleStop(module); } array_destroy(copy); } else spinlock_unlock(&__ioglued_lock); sd_yield(); } }
void libio_worker(IOThread *thread) { IOAutoreleasePool *pool = IOAutoreleasePool::alloc()->init(); thread->setName(IOString::withCString("libio worker")); pool->release(); while(1) { //pool->release(); //pool = IOAutoreleasePool::alloc()->init(); sd_yield(); } }