|
hmm... Are you doing this from a service or is it not working in a regular app?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have it working in dialog app, but I need to get it working in my service app.
|
|
|
|
|
Ok now that I'm caught up...
Have you done everything required here[^]?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hy there!
i have a hughe problem in my company. i have a quite complex application (distributed, corba, mulithreaded, Boost, QT 3.3)
and after closing the program (int closeevent() pApp->exit())
the program closes but after ca 5 sec. there comes an ASSERTION
attached_thread_count == 0
in tss_hooks.cpp
the code in boost looks like that:
attached_threadcount == 0 in tss_hooks.cpp. the code there looks like this:
it is in on_process_exit()..
catch( ... )
{
boost::call_once(init_threadmon_mutex, once_init_threadmon_mutex);
boost::mutex::scoped_lock lock(*threadmon_mutex);
BOOST_ASSERT(attached_thread_count == 0);
return -1;
even with the help of some c++ gurus and DevPartnerStudio we could not find the problem.
actually it isnt that annoying because only at exit it happens. but we cant deliver it to the customer like that.
does enyone has an idea what to do against it, even a trick to just dont show the assertion?
unfortunately i cant make a release-version for different reasons.
ideas? suggestions??
thanx for any input!!
p.s. someone gave me the following input in an other board:
Anyway, the assertion comes from the thread_specific_ptr machinery. It means that something registered a thread-exit handler but it wasn't called. This might happen if, for example, you use a thread_specific_ptr from a thread that wasn't created with boost::threads.
andreas
|
|
|
|
|
The problem isn't the ASSERT but what thread is not terminated. It's the 1st priority to check which thread and what line in the thread is still busy when the exit signal has been fired.
And why does it enter the catch block?! What throws?
Maxwell Chen
|
|
|
|
|
andreas.schaerer wrote: even a trick to just dont show the assertion?
abort[^] should do the trick, but I would ask the question on a Boost mailing list to properly fix the problem.
|
|
|
|
|
I am trying to play a AVI file on status bar indicating the progress for the lengthy operation.
I am doing this in a button click event. it is working fine if no statements are there below the call and, if there are statements below the avi start.. the avi is not playing on status bar.
I tryed with thread, but of no use.
void TestPb::OnButton1()
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
pFrame->StartAnimation( IDR_AVITEST ,1);
whie(1)//Say length process.... If i comment while(1) .. avi is playing on mainfram status bar
{}
}
|
|
|
|
|
you should move the portion of code playing the AVI in its own thread... and start the thread on the trigger of your choice.
|
|
|
|
|
I tried placing in threaed but failed
|
|
|
|
|
ptr_Electron wrote: I tried placing in threaed but failed
how did you do that ?
|
|
|
|
|
super_ttd wrote: how did you do that ?
Oh it's easy, you just do something or other
led mike
|
|
|
|
|
Hi,
Its hard to give you advice without seeing what type of 'processing' you are doing. You should avoid drawing on a window from a separate thread if at all possible. You may be able to simply pump the message que and move the AVI-frame painting into OnPaint.
In the while loop you can probably add:
while(somecondition)
{
MSG oMSG;
while(::PeekMessage(&oMSG, NULL, 0, 0, PM_NOREMOVE))
{
if(::GetMessage(&oMSG, NULL, 0, 0))
{
::TranslateMessage(&oMSG);
::DispatchMessage(&oMSG);
}
else
{
break;
}
}
}
pre>
This will allow the dialog to process WM_PAINT messages normally.
|
|
|
|
|
you certainly didn't want to say that to our great toxcct, did you ?
|
|
|
|
|
oops!
|
|
|
|
|
Thanks you very much, for your help, what I am trying to do is extrading 1000's of records from database. since it takes quite some time I want play the avi file on the status bar of main frame,
but the call will be made from the dialg. say on button click event we are extracting records form DB and need progress on the status bar, but does not work...
void TestPb::OnButton1()
{
thpbar=AfxBeginThread(thPrgbar,THREAD_PRIORITY_NORMAL,0,0,NULL);
//Get 1000's records from DB ..verytime consumming process...
}
UINT TestPb::thPrgbar( LPVOID pParam )
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
pFrame->StartAnimation( IDR_AVITEST ,1);
return (1);
}
void CMainFrame::StartAnimation( UINT id, int nPane /*=1*/ )
{
StopAnimation();
m_pAnimate = new CStatusbarAnimate;
m_pAnimate->Create(id, nPane);
}
void CMainFrame::StopAnimation()
{
delete m_pAnimate;
m_pAnimate = NULL;
}
bool CMainFrame::IsAnimationActive()
{
return (m_pAnimate != NULL);
}
// needed to ensure original text not visible
void CMainFrame::OnUpdateAnimate(CCmdUI* pCmdUI)
{
pCmdUI->SetText(_T(""));
}
|
|
|
|
|
Perhaps you should move to a message based inter-thread communication. You can even pass the percentage of completion.
Try something like this:
#define WM_START_ANIMATION WM_USER + 0x8
#define WM_INC_PROGRESS WM_USER + 0x10
void TestPb::OnButton1()
{
thpbar=AfxBeginThread(thPrgbar,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT TestPb::thPrgbar( LPVOID pParam )
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
::PostMessage(pFrame->GetSafeHwnd(),WM_START_ANIMATION,IDR_AVITEST,1);
int iCount;
int iPosition =0;
while(reading DB)
{
int iPercent = iCount * (iPosition / 100.0);
::PostMessage(pFrame->GetSafeHwnd(),WM_INC_PROGRESS,(WPARAM)iPercent,0);
++iPosition;
}
return (1);
}
void CMainFrame::OnStartAnimation( WPARAM id, WPARAM nPane )
{
StopAnimation();
m_pAnimate = new CStatusbarAnimate;
m_pAnimate->Create(id, nPane);
}
void CMainFrame::StopAnimation()
{
if(IsAnimationActive())
{
delete m_pAnimate;
m_pAnimate = NULL;
}
}
bool CMainFrame::IsAnimationActive()
{
return (m_pAnimate != NULL);
}
void CMainFrame::OnUpdateAnimate(CCmdUI* pCmdUI)
{
pCmdUI->SetText(_T(""));
}
Add the following to your CMainFrame
afx_msg LRESULT OnMyProgress(WPARAM wParam, LPARAM lParam);
ON_MESSAGE(WM_INC_PROGRESS,OnMyProgress)
ON_MESSAGE(WM_START_ANIMATION,OnStartAnimation)
LRESULT void CMainFrame::OnMyProgress(WPARAM wParam, LPARAM lParam)
{
int iPercent = (int)wParam;
if(100 == iPercent && IsAnimationActive())
{
StopAnimation();
}
else
{
}
|
|
|
|
|
while (1); not only stops avi to play, but the complete UI on the GUI thread will stop working.
|
|
|
|
|
well, Yes true just i mentioned to as a length process
Thanks u
I want to paly the avi on the mainfram status bar and start some lenthly process, while still the avi is playing... pls advice
|
|
|
|
|
ptr_Electron wrote: well, Yes true just i mentioned to as a length process
Thanks u
I want to paly the avi on the mainfram status bar and start some lenthly process, while still the avi is playing... pls advice
I would run the lengthy operation in a background thread.
Nathan
|
|
|
|
|
HI everyone,
Can someone help me with this.
I founded out that when the recycle bin has a lot of file using the command SHFileOperation to delete file is VERY SLOW!!!!
How can I either fix this or inform the user that since it recycle bin contains (x file, knowing the x threshold would be great )
Thanks anyone!
|
|
|
|
|
Member 3854600 wrote: inform the user that since it recycle bin contains (x file
SHQueryRecycleBin (gives total size, number of items)
Member 3854600 wrote: How can I either fix
SHEmptyRecycleBin (shows progress bar) check this iam not sure.
|
|
|
|
|
OK thanks this is great, but does anybody knows the number X of file in the recycle bin, that causes the SHFileOperation to be slow??
Thanks
|
|
|
|
|
|
SetWindowContextHelpId always fails form dialog and also from base class, Any possible fix ideas please. Dialogs are not MFC generated code
Thanx
|
|
|
|
|
*sigh*
Return Value Returns nonzero if successful, or zero otherwise. To retrieve extended error information, call GetLastError.
led mike
|
|
|
|