Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code within a thread freezes Firefox 3 during execution

0 views
Skip to first unread message

s...@hi-net.ru

unread,
Jul 2, 2008, 9:20:51 AM7/2/08
to
Hi All !
I was made extension for FF 1.5 / 2.x and it works fine. But in FF 3,
i got the
next trouble :
When my thread is running, the FF UI is frozen, here is part of code
which
creates thread and do the some job within thread

void MyExtension::Start()
{
...
if (NS_FAILED(threadManager->NewThread(0,
getter_AddRefs(m_WorkingThread))))
{
throw;
}
m_WorkingThread->Dispatch(this, nsIThread::DISPATCH_NORMAL);
...
}

void MyExtension::OnDataReceived(void* p)
{
SetEvent(((MyExtension*)p)->m_ThreadEvent);
}

NS_IMETHODIMP MyExtension::Run()
{
WCHAR szName[256];
memset(szName, 0, sizeof(szName));
_ltow((long)this, szName, 10);
m_ThreadEvent = CreateEvent(NULL, FALSE, FALSE, szName);
ResetEvent(m_ThreadEvent);

m_pProcessor->AttachCallback(this, &Handler::OnDataReceived);
m_sMime.Assign(m_pProcessor->Start());

UINT32 nTimeoutCount = 0;
while (WaitForSingleObject(m_ThreadEvent, 1000) ==
WAIT_TIMEOUT)
{
nTimeoutCount++;
if (nTimeoutCount == 120)
return NS_ERROR_FAILURE;
}

m_pProcessor->Finish();

m_pProcessor->GetDataAndClear((void**)&m_pData,
&m_DataLength);
delete m_pProcessor;
m_pProcessor = NULL;

return NS_OK;
}

what's wrong here ?

s...@hi-net.ru

unread,
Jul 7, 2008, 1:33:51 AM7/7/08
to
it's still actually for me
0 new messages