No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hi, I have a general question about for example a continuous while loop. If we have a while(true) loop that will keep going for 24 hours without any Thread.Sleep(), where the processor will be completely busy all the time. Is this a good or bad practise, or is it okay … | |
Hi, I have created a Form C# application that has alot of code inside. Runs on QuadCore processor. The problem consumes about 2-5% CPU in general when looking in TaskManager. **Problem:** At some point the application consumes about 60-70% and stucks there forever. So I am very sure that somewhere … | |
Hi, I simply if it is an okay practise to use lock objects in functions which is not a background thread. If we assume that the code that exist in those lock object is no more than just say 5-10 lines of code, which takes less than 1 milliseconds to … | |
Hi, I have done a test using the lock(lockobject), which will be an interesting question. I have created 2 background threads, that I start simultaniously. Threads uses a while(true) loop to produce the test. If we uncomment and use the lock(lockobject) in the code. None of the loops will write … | |
Hi, I have never used SpinWait. I am waiting for a lockfile to be free, so we can lock the file with below code (FileShare.None) This lockfile will always be avaliable in approx. <= 50 milliseconds. I will be needed to react as fast as possible so I beleive it … | |
Hi, I have a backgroundthread where I in this moment is using: while (runsomeCode == false) { Thread.Sleep(1); } to wait for "runsomeCode" will turn to: 'true' from another thread, which is button9_Click in this example. However, using Thread.Sleep(1) doesn´t seem to be a very effective way. I wonder if … | |
Hi, I have a question about the threadpool. ThreadPool accepts to pass along an object as shown in my code. I will pass along 3 doubles, which I ofcourse could make to a string object, - and then convert it back to doubles in the "receiveDoubles" function. This is no … | |
Hi, I have 2 different applications(Application 1 and Application 2) that have a critical area of code where only 1 application can be a time. The solution I have come up with is to use a lockfile so the application knows about when the other application is in the critical … |