Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


STL their function mistake! ! ?

I found the time to do a pressure test error was discovered last for a long time to find itself STL function, the following error is part of a code is very simple :
A thread
While (!sendqueue.empty ())
{                                       
Try
  {
Handlequeue.front &tempbuf string = ();
  }
Catch (. . . )
{
Messagebox (0, "handlequeue.front () problem", 0,0);
  }
.....
                                               
The answer lies in front function is a queue<string>; handlequeue the queue thread in Wanglimian push data B, A thread in its data processing trucks when they did not see anything unusual when thread B will happen handlequeue.front (a) Exception dished out! What caused that? How to solve?

STL their function mistake! ! ?

Initially, I think it is not too fast even handlequeue B-thread processing problems encountered by the rapid expansion of space, but should not be more than A thread Thread B faster, because the implementation of a long process of treatment in B-thread function more. Later, I wish Do not queue thread safe? But just to push into the tail, and front cloth is removed from scratch, take over, it is empty (when the data processing out after I use pop), the home-waiting signal (each time I push will turn on a signal home, so handle both handlequeue air time for the signal out) But there are those who may question. Maybe once or front () anomalies, always stay in front while there are always anomalies, Queue is not empty, the front can not be successful, we seem handlequeue collapse of the enemy.

STL their function mistake! ! ?

STL is not thread safe. You may be synchronized, said elaborate.
As for the STL code is correct, I can say that's not entirely correct code, but at least at this level, should be wrong.

STL their function mistake! ! ?

Stl not thread safe. Therefore can not be protected under the circumstances, the use of multithreading environment.

-->

But no. Even a simple variable-plus-one overall operation, if no special protection, multithreading environment wrong and what indescribably more push, the pop. [/quote]-->-->

STL their function mistake! ! ?

Next tailgating

STL their function mistake! ! ?

The code on this thread B
Readysend=HandleMsgFunc1 (recvbuffer.c_str ()); 4003rd readysend whole string of variables
If (!readsend.empty ())
{
Handledqueue.push (readsend);
SetEvent (SendEvent);
}
A thread :
While (WAIT_OBJECT_0 ====== WaitForSingleObject (m_hHandleEvent, INFINITE))
{
While (!sendqueue.empty ())
{
Try
{
Handlequeue.front &tempbuf string = ();
}
Catch (. . . )
{
Messagebox (0, "handlequeue.front () problem", 0,0);
}
....
Handledqueue.pop ();
ResetEvent (sendevent);

}
B thread from the network after receiving the news of processed into a queue.
A thread for processing queue has been removed from the elements to send to the network.

Do stress tests : a tool to transmit 100 bytes of random death for her to accept the contents of the server, not sleep halfway, but only from the network so they can return before the next transmission, which means the receiving and sending of obstruction. A total of about one second a tool for the collection of information 500-1000; Server received only made a simple reply to the package. The results showed that when it also sent a server tools to work together when problems arise, the problem lies in front STL queue () function! But dished out the abnormal range, sometimes 30 seconds, sometimes 1,2 minutes, but not more than three minutes, opening 3-4 general pressure on the tool problems.

STL their function mistake! ! ?

I can understand it, seems incompatible spent brackets?

STL their function mistake! ! ?

The brackets will not be less, I might be a little stickers procedure is the way to help me analyze

STL their function mistake! ! ?

I did not agree with the view of C + +
Although you do not see the source, not a conclusion, but the problem is in your own code is the possibility of their problems are far greater than the possibility stl.
The problem most likely lies in the simultaneous multithreading, recommended careful look at the content of the event

STL their function mistake! ! ?

Thank you greatly! Based on the original signal in a mutex to control the queue at the same time to visit the ongoing pressure testing, the tool also opened four pressure problems before, news about 1500-2000 UTC

STL their function mistake! ! ?

I drive 10 minutes of the dead, or front () mistake! Critical, signal mutex have been used on various occasions, or Die! STL has no choice but to believe that the problem, or a problem only VC STL? I write the following code in vc. Dbgheap.c document asserted there had a problem somewhere, it is to define the system

STL their function mistake! ! ?

You give me a complete code, as long as it is in C + +, and I have confidence Bangnigaoding

STL their function mistake! ! ?

If handlequeue collapse of the case, how can re-use it to restore

STL their function mistake! ! ?

You would not protect handledqueue code stickers, die strange.

STL their function mistake! ! ?

STL their function mistake! ! ?

A signal control, the pressure will signal information into home-extracting information will be sent after the completion of signal out, but to listen to people's views, added a mutex, visit the restrictions cohort, I have spoken earlier reply to the above clear now, the problem is still there. When pressure testing tool with a sleep (50) does not die when (the reasons for the slow pace of bars), sleep will die if we do not send too fast, but to server? The front of the queue is shown abnormal function abnormalities. I now want to know is : If cohort collapse, and restoring it is renewed, is there a way to have this anomaly can be seen more detailed information

STL their function mistake! ! ?

Mutex is no increase right. It is known affixed with a code.

STL their function mistake! ! ?

Canada contradict simply not right to not increase, if the increase is not, then explain how to specify a period of sleep, if not dead, there is the issue of how there front () abnormal reasons, I think it is not push security function, it may be incorrect memory allocation (may push that front. pop very quickly, the situation will be unusual), resulting in abnormal dished out front?

STL their function mistake! ! ?

This, the VC STL if you suspect a problem, you can download one to use. SGI STL, or if there are problems, to see their bar codes.
VC deque codes there, you should read their own, there should be no problem.
I reiterate that although VC poor-quality, but the programmers had some problems, we should first suspected, doubts about the environment.
Since you said : "The increase is very simple contradict will not increase the bars," I can also say that the writing is very simple deque bar, PJ will not write the bar.

STL their function mistake! ! ?

Multithreaded programming is the random error occurred. Why not.
Simply push the realization of Microsoft when you really write what is that thing called PJ STL is imbecile?

Bears the code is "hollow."



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com