You must always lock a data structure consistently, before reading as well as writing. Your function DoSomething must lock. A sleep will always be the wrong length and is never, ever the right solution to a race condition. What I mean is, in some circumstances the sleep won't be long enough for the other condition to complete; in others, the operation will complete early and the sleep just wastes time.
Locks only block another thread if the two threads explicitly lock the same data structure.
This will produce random output, it seems the threads get different time slices every time I execute the program, how come?
Because thread scheduling depends on the load of all the other things going on in the system. Just moving the mouse slightly differently can have an effect.
If you don't understand locks I would recommend steering well clear of lock-free programming.
DoEvents: Generating unexpected recursion since 1991
So in an MSI sense you have a custom action in the InstallUISequence which accepts (per dialog) and validates a serial number. But what does "verify" mean? Do you set a variable which is checked in another action?
In repair mode your serial number dialog is not shown, right? So verification must take place somewhere else. Maybe you can give further details here.
MessageBox.Show("No value in first text box");
panel2.Visible = false;
panel3.Location = panel2.Location;
panel5.Size = panel5.Size - panel2.Size;
int hight=this.Size.Height -panel2.Size.Height;
this.Size = new System.Drawing.Size(this.Width,hight);
here am trying to eliminate the space left after hiding a panel2
I am trying to create a CPU Usage monitoring application. I am using PerformanceMonitor to do it. However as I was observing the data from Task Manager's CPU Usage column (Process Tab) and Performance Monitor (Process - % Processor Time) readings, they don't seem to coincide at all (Not even close). I tried to change the Performance Monitors sampling interval, but I can't seem to make the 2 coincide.
I do not know if this is possible, but it is worth a try.
I am currently integrating with a module from Accpac. By using the dll's. The data you insert through the dll is very specific. If i run the macro generated from Accpac, it will return a message to me. eg. The invoice nr have been used. But when the error is in c# i just get a Com Exception.
I want to be able to get the message from the dll, to show as exception in C#..