rv = fts->CreateTransport(spec, "load", nsnull, &trans);
rv = fts->CreateTransport(spec, "load", &trans);
ParallelReadTest(char* dirName, nsIFileTransportService* fts){    nsresult rv;    PRStatus status;    PRDir* dir = PR_OpenDir(dirName);    NS_ASSERTION(dir, "bad dir");    nsISupportsArray* threads;    rv = NS_NewISupportsArray(&threads);    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewISupportsArray failed");    PRDirEntry* entry;    while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != nsnull) {        nsFileSpec spec(dirName);        spec += entry->name;        nsReader* reader = new nsReader();        NS_ASSERTION(reader, "out of memory");        NS_ADDREF(reader);        nsIThread* readerThread;        rv = NS_NewThread(&readerThread, reader, 0, PR_JOINABLE_THREAD);        NS_ASSERTION(NS_SUCCEEDED(rv), "new thread failed");        rv = reader->Init(readerThread);        NS_ASSERTION(NS_SUCCEEDED(rv), "init failed");        nsIStreamListener* listener;        reader->QueryInterface(NS_GET_IID(nsIStreamListener), (void**)&listener);        NS_ASSERTION(listener, "QI failed");            nsIChannel* trans;        rv = fts->CreateTransport(spec, "load", nsnull, &trans);        NS_ASSERTION(NS_SUCCEEDED(rv), "create failed");        rv = trans->AsyncRead(0, -1, nsnull, listener);        NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncRead failed");        // the reader thread will hang on to these objects until it quits        NS_RELEASE(trans);        NS_RELEASE(listener);        NS_RELEASE(reader);        rv = threads->AppendElement(readerThread) ? NS_OK : NS_ERROR_FAILURE;  // XXX this method incorrectly returns a bool        NS_ASSERTION(NS_SUCCEEDED(rv), "AppendElement failed");        NS_RELEASE(readerThread);    }    // now that we've forked all the async requests, wait until they're done    PRUint32 threadCount;    rv = threads->Count(&threadCount);    for (PRUint32 i = 0; i < threadCount; i++) {        nsIThread* thread = (nsIThread*)threads->ElementAt(i);        thread->Join();        NS_RELEASE(thread);    }    NS_RELEASE(threads);    status = PR_CloseDir(dir);    NS_ASSERTION(status == PR_SUCCESS, "can't close dir");}