* Moved thread function into the class.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42947 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2011-10-29 12:22:56 +00:00
parent 4b2c09b6b3
commit 3928c786a0
@@ -17,13 +17,15 @@
#include <crypt.h> #include <crypt.h>
const uint32 kMsgStartWatching = '&StW';
DispatcherIMAPListener::DispatcherIMAPListener(MailProtocol& protocol, DispatcherIMAPListener::DispatcherIMAPListener(MailProtocol& protocol,
IMAPStorage& storage) IMAPStorage& storage)
: :
fProtocol(protocol), fProtocol(protocol),
fStorage(storage) fStorage(storage)
{ {
} }
@@ -74,15 +76,7 @@ DispatcherIMAPListener::FetchEnd()
} }
const uint32 kMsgStartWatching = '&StW'; // #pragma mark -
int32
watch_mailbox(void* data)
{
((IMAPMailboxThread*)data)->_Watch();
return B_OK;
}
IMAPMailboxThread::IMAPMailboxThread(IMAPInboundProtocol& protocol, IMAPMailboxThread::IMAPMailboxThread(IMAPInboundProtocol& protocol,
@@ -122,7 +116,7 @@ IMAPMailboxThread::SyncAndStartWatchingMailbox()
BAutolock autolock(fLock); BAutolock autolock(fLock);
if (fIsWatching) if (fIsWatching)
return B_OK; return B_OK;
fThread = spawn_thread(watch_mailbox, "IMAPMailboxThread", fThread = spawn_thread(_WatchThreadFunction, "IMAPMailboxThread",
B_LOW_PRIORITY, this); B_LOW_PRIORITY, this);
if (resume_thread(fThread) != B_OK) { if (resume_thread(fThread) != B_OK) {
fThread = -1; fThread = -1;
@@ -159,6 +153,15 @@ IMAPMailboxThread::StopWatchingMailbox()
} }
/*static*/ status_t
IMAPMailboxThread::_WatchThreadFunction(void* data)
{
((IMAPMailboxThread*)data)->_Watch();
return B_OK;
}
void void
IMAPMailboxThread::_Watch() IMAPMailboxThread::_Watch()
{ {
@@ -181,7 +184,6 @@ MailboxWatcher::MailboxWatcher(IMAPInboundProtocol* protocol)
: :
fProtocol(protocol) fProtocol(protocol)
{ {
} }
@@ -223,7 +225,7 @@ MailboxWatcher::MessageReceived(BMessage* message)
fProtocol->AppendMessage(ref); fProtocol->AppendMessage(ref);
break; break;
case B_ENTRY_REMOVED: case B_ENTRY_REMOVED:
message->FindInt32("device", &nref.device); message->FindInt32("device", &nref.device);
message->FindInt64("node", &nref.node); message->FindInt64("node", &nref.node);