473,468 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

cannot use __try in functions that require object unwinding

10 New Member
can anybody point me where is the unwiding object in this code

Expand|Select|Wrap|Line Numbers
  1. DWORD WINAPI MAC_out_Thread( LPVOID lpParam ) {
  2.  
  3.  
  4.    int size_of_LLC_out_Queue= 0;
  5.  
  6.    mac_frame MAC_FRAME_TEMPLATE;
  7.  
  8.  
  9.  
  10.  
  11.  DWORD  MAC_QU_WaitResult, LLC_QU_WaitResult, ARP_TABLE_WaitResult;
  12.  
  13.  LLC_QU_WaitResult =  WaitForSingleObject(LLC_out_Queue_Mutex,INFINITE); 
  14. string mac = GetMACaddress();
  15.  
  16. while(1){           
  17.       switch (LLC_QU_WaitResult) 
  18.         {
  19.            case WAIT_OBJECT_0: 
  20.                 __try { 
  21.                  ARP_TABLE_WaitResult =  WaitForSingleObject(ARP_table_Mutex,INFINITE); 
  22.                     switch (ARP_TABLE_WaitResult) 
  23.                              {
  24.                                  case WAIT_OBJECT_0: 
  25.                                  __try { 
  26.                                       size_of_LLC_out_Queue = LLC_out_Queue.size();
  27.                                       if(size_of_LLC_out_Queue > 0)
  28.                                         {
  29.                                    ARP_iterator = ARP.find(LLC_out_Queue[LLC_out_Queue.size() - 1].data.DIP); 
  30.                                     if (ARP_iterator != ARP.end())
  31.                                     strcpy(MAC_FRAME_TEMPLATE.DA,ARP_iterator->second.c_str());
  32.                                        else
  33.                                     strcpy(MAC_FRAME_TEMPLATE.DA,FAKE_MAC_Switch.c_str());
  34.                                     MAC_FRAME_TEMPLATE.data = LLC_out_Queue[LLC_out_Queue.size() - 1];
  35.                                     strcpy(MAC_FRAME_TEMPLATE.SA,mac.c_str());
  36.                                     LLC_out_Queue.pop_back();
  37.                                     MAC_out_Queue.push_back(MAC_FRAME_TEMPLATE);
  38.                                         }
  39.                                         }
  40.                                  __finally { 
  41.                                   ReleaseMutex(ARP_table_Mutex);
  42.                                        }
  43.  
  44.                              }
  45.                     }
  46.               __finally { 
  47.                  ReleaseMutex(LLC_out_Queue_Mutex);
  48.                  }
  49.                break;
  50.          }
  51.  
  52.  
  53.  
  54.       Sleep(400);
  55.       LLC_QU_WaitResult =  WaitForSingleObject(LLC_out_Queue_Mutex,INFINITE); 
  56.  
  57.     }
  58.  
  59.  
  60.     return 0; 
  61.  
  62. }
  63.  
Oct 1 '10 #1
1 3967
weaknessforcats
9,208 Recognized Expert Moderator Expert
It's somewhere between the __try and the __finally.

Bad code. The __try should be limited to one function call.

With many calls in a __try block you can't tell how far you got into the block before the exception was thrown.

So you may have done a little, or a lot, of processing.
Oct 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: salih ataoz | last post by:
i close a form and i want to open it again it show me Cannot access a disposed object at vb6 this is ok at comman1_click form1.show
7
by: Ryan Park | last post by:
Hi, //SITUATION I got a panel control that hold a certain position on a form. Every controls or UIs are on this panel. At certain situation, I called dispose() method of this panel control...
5
by: D Witherspoon | last post by:
I use the following code to open up a form. ------------------------------------------------------- If fImage Is Nothing Then fImage = New frmImage End If fImage.Show()
1
by: Svyatoslav | last post by:
Hi, I have a problem with XmlNodes and my stack. It looks something like this: //declarations XmlNode node, new_node; Stack MyStack = new Stack(); //code MyStack.Push(node);
0
by: Asaf | last post by:
Hi, When I am doing a POST to a SSL URL I am getting this error on first attempt "Cannot access a disposed object named "System.Net.TlsStream"." After the first attempt all works fine, here is the...
9
by: Andy Sutorius | last post by:
Hi, I am receiving the error when compiling the project, "cannot implicitly convert type object to string". The error points to this line of code and underlines the dtrRecipient:...
7
by: ed | last post by:
Hi, Here's my code 'in form WithEvents formReplace As New Form Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Clic formReplace.Show(
0
by: tom | last post by:
When I try to read in a csv file it gives me this error message. 'Cannot update. Database or object is read-only.' If I change the extension to txt it processes just fine. I have googled all...
0
by: sdanda | last post by:
Hai i am working on vb.net. In my application I created four forms.Those are first.vb,f1.vb,f2.vb and f3.vb In firstvb I added 3 checkboxes and a "display" button.The 3 checkboxes are used to...
4
JustRun
by: JustRun | last post by:
Hi All, I'm developing a windows desktop solution using VC# , I deal with my database using Dataset. My Problem that i'm trying to call a Form to display a confirmation message after every...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.