pushed the stream listener hand off into the constructor so it's know before the thread is run

This commit is contained in:
valeski%netscape.com 1999-04-22 19:28:30 +00:00
parent 119aa05555
commit c9657c11d3
2 changed files with 9 additions and 10 deletions

View File

@ -53,13 +53,14 @@ nsFtpConnectionThread::QueryInterface(const nsIID& aIID, void** aInstancePtr) {
return NS_NOINTERFACE;
}
nsFtpConnectionThread::nsFtpConnectionThread(PLEventQueue* aEventQ) {
nsFtpConnectionThread::nsFtpConnectionThread(PLEventQueue* aEventQ, nsIStreamListener* aListener) {
mEventQueue = aEventQ; // whoever creates us must provide an event queue
// so we can post events back to them.
mListener = aListener;
NS_ADDREF(mListener);
}
nsFtpConnectionThread::~nsFtpConnectionThread() {
NS_IF_RELEASE(mThread);
NS_IF_RELEASE(mListener);
}
@ -400,11 +401,9 @@ nsFtpConnectionThread::Run() {
//lCPipe->CloseConnection();
}
nsresult nsFtpConnectionThread::Init(nsIThread* aThread, nsIStreamListener* aListener) {
mThread = aThread;
nsresult nsFtpConnectionThread::Init(nsIThread* aThread) {
/* mThread = aThread;
NS_ADDREF(mThread);
mListener = aListener;
NS_ADDREF(mListener);
PRThread* prthread;
aThread->GetPRThread(&prthread);
@ -413,7 +412,7 @@ nsresult nsFtpConnectionThread::Init(nsIThread* aThread, nsIStreamListener* aLis
// wake up event loop
PR_CNotify(this);
PR_CExitMonitor(this);
*/
return NS_OK;
}

View File

@ -80,13 +80,13 @@ class nsFtpConnectionThread : public nsIRunnable {
public:
NS_DECL_ISUPPORTS
nsFtpConnectionThread(PLEventQueue* aEventQ);
nsFtpConnectionThread(PLEventQueue* aEventQ, nsIStreamListener *aListener);
~nsFtpConnectionThread();
// nsIRunnable method
NS_IMETHOD Run();
nsresult Init(nsIThread* aThread, nsIStreamListener* aListener);
nsresult Init(nsIThread* aThread);
// user level setup
@ -95,7 +95,7 @@ private:
void SetSystInternals(void);
PLEventQueue* mEventQueue; // used to communicate outside this thread
nsIThread* mThread; // the worker thread
// nsIThread* mThread; // the worker thread
FTP_STATE mState; // the current state
FTP_STATE mNextState; // the next state