Closed Bug 200152 Opened 21 years ago Closed 21 years ago

Clean up usage of nsImapProtocol::m_imapThreadIsRunning

Categories

(MailNews Core :: Backend, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emaijala+moz, Assigned: emaijala+moz)

Details

Attachments

(1 file, 2 obsolete files)

I suspect enter/exit monitor is missing from
nsImapProtocol::ImapThreadIsRunning() making it possible to read it while it's
being assigned in the thread. Patch coming up.
Attachment #119093 - Flags: superreview?(bienvenu)
is this variable ever accessed from a thread other than the imap thread?
Comment on attachment 119093 [details] [diff] [review]
Patch to add the enter/exit monitor to protect from access from multiple threads

Right, it isn't. Then I'd say this little function is quite useless. It could
only protect from starting multiple threads which shouldn't happen anyway,
right?
Attachment #119093 - Attachment is obsolete: true
Attachment #119093 - Flags: superreview?(bienvenu)
Okay, it _is_ actually set outside the thread in TellThreadToDie(), where it
isn't protected by the same monitor as elsewhere. This fixes both.
Comment on attachment 119099 [details] [diff] [review]
Second try, now protects the setting in TellThreadToDie() too

David, what do you think?
Attachment #119099 - Flags: superreview?(bienvenu)
I'm not convinced we need to set isthreadrunning to false in TellThreadToDie -
it already sets m_threadShouldDie, which is checked in DeathSignalReceived. It
would be nice to remove the monitor calls instead of adding them, if we can
convince ourselves/make it so it's only accessed from one thread.
Comment on attachment 119099 [details] [diff] [review]
Second try, now protects the setting in TellThreadToDie() too

I wonder if we really need the flag at all, but I'll make it so it's not used
outside the thread.
Attachment #119099 - Attachment is obsolete: true
Attachment #119099 - Flags: superreview?(bienvenu)
Summary: Should protect nsImapProtocol::ImapThreadIsRunning() with a monitor → Clean up usage of nsImapProtocol::m_imapThreadIsRunning
Comment on attachment 119108 [details] [diff] [review]
3rd try, clean up the usage of m_imapThreadIsRunning

Ok, could this finally be the right way to do it?
Attachment #119108 - Flags: superreview?(bienvenu)
Comment on attachment 119108 [details] [diff] [review]
3rd try, clean up the usage of m_imapThreadIsRunning

it looks ok to me - does it work? In order to hit the tellthreadtodie code, I
think you need to have an imap connection timeout, or just shutdown.
Attachment #119108 - Flags: superreview?(bienvenu) → superreview+
Yes, it works. I've ran it in debugger to check that it goes as expected. 
Attachment #119108 - Flags: review?(sspitzer)
Attachment #119108 - Flags: review?(sspitzer) → review?(mscott)
Comment on attachment 119108 [details] [diff] [review]
3rd try, clean up the usage of m_imapThreadIsRunning

Moving over to Scott's new adress. Scott, this patch already has superreview
from David Bienvenu. Can you please review?
The patch is a little bit bitrotted (the line numbers no longer apply), but in
itself it is still valid.
Attachment #119108 - Flags: review?(mscott) → review?(mscott)
Attachment #119108 - Flags: review?(mscott) → review+
Thanks a bunch! Fix checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: