static void uninit() { unregister_generic_syscall(LAUNCH_SPEEDUP_SYSCALLS, 1); recursive_lock_lock(&sLock); // free all sessions from the hashes uint32 cookie = 0; Session *session; while ((session = (Session *)hash_remove_first(sTeamHash, &cookie)) != NULL) { delete session; } cookie = 0; while ((session = (Session *)hash_remove_first(sPrefetchHash, &cookie)) != NULL) { delete session; } // free all sessions from the main prefetch list for (session = sMainPrefetchSessions; session != NULL; ) { sMainPrefetchSessions = session->Next(); delete session; session = sMainPrefetchSessions; } hash_uninit(sTeamHash); hash_uninit(sPrefetchHash); recursive_lock_destroy(&sLock); }
Session::~Session() { mutex_destroy(&fLock); // free all nodes if (fNodeHash) { // ... from the hash uint32 cookie = 0; struct node *node; while ((node = (struct node *)hash_remove_first(fNodeHash, &cookie)) != NULL) { //TRACE((" node %ld:%Ld\n", node->ref.device, node->ref.node)); free(node); } hash_uninit(fNodeHash); } else { // ... from the list struct node *node = fNodes, *next = NULL; for (; node != NULL; node = next) { next = node->next; free(node); } } StopWatchingTeam(); }
/*static*/ void chain::DeleteChains(hash_table* chains) { uint32 cookie = 0; while (true) { struct chain* chain = (struct chain*)hash_remove_first(chains, &cookie); if (chain == NULL) break; chain->Uninitialize(); delete chain; } }
status_t uninit_stack() { TRACE(("Unloading network stack\n")); put_module(NET_SOCKET_MODULE_NAME); uninit_timers(); uninit_device_interfaces(); uninit_interfaces(); uninit_domains(); uninit_notifications(); mutex_destroy(&sChainLock); mutex_destroy(&sInitializeChainLock); // remove chains and families chain::DeleteChains(sProtocolChains); chain::DeleteChains(sDatalinkProtocolChains); chain::DeleteChains(sReceivingProtocolChains); uint32 cookie = 0; while (true) { struct family* family = (struct family*)hash_remove_first(sFamilies, &cookie); if (family == NULL) break; delete family; } hash_uninit(sProtocolChains); hash_uninit(sDatalinkProtocolChains); hash_uninit(sReceivingProtocolChains); hash_uninit(sFamilies); return B_OK; }