In many cases, it will be faster to blindly write to a variable than to do so conditionally, though the difference is unlikely to be great. The only time that conditional writing would be faster be in multi-CPU architectures which require pre-arbitration of memory writes (which is how I understand some of them work). In that scenario, if two CPU's were repeatedly trying to write 1 to the same variable, performance may be quite poor as the CPU's would spend considerable time acquiring and releasing control of the cache page holding the variable in question. If instead the variable was only written once and the CPU's simply had to read it repeatedly, the variable could be held in both CPU's caches with zero time wasted on arbitration.
(but its only reasonable if you can't inline the foo function)
In this example you just have to call foo() (what will be "inlined" be the compiler)
At the first call it calls _FooFuncAndSetBool. There it sets the bool value bWasFooEverCalled
and after that it set the function pointer to the function _FooFuncWithoutSetBool.
Every later "inlined" call to foo() will just call you funtion without setting or checking
But as I mentioned before its only reasonable if your foo() funtion itself can't be inlined,
because there will always be a call statement in assembler and call statements are
always slower then "inlining" a function.
From Client i am sending the Data. First Time the Data is Sucsefully Transmitted. But in the Second time When i am trying to Bind the Socket in Server Side it is giving an error such that WSAEADDRINUSE. the second time onwards i am not able to bind the socket and not able to send data towards the server machine. please help me out.
I have maintained two threads for both Client and Server. I mean I created a Thread in Button Click events of both Server & Client, There i have created a socket connection.
So it is giving that error. Any problem in doing that.
in Server Side
In Button Click Event of the Dialog, I created a Thread and inside the Thread i have written the Above Procedure to Connect the Thread and Bind. First time it is ok. But Second time Bind is been failed.
what is the wrong with the Code. Please help me out.
Thanks & Regards,
any thread function (for an one client solution) may have
- a beginning part (server: create/bind/listen/accept, client: create/connect)
- a loop part (server & client: recv/send)
- an ending part (server & client: close)
So you have the only one call for bind
Check your definition of Irrationality[^]
1 - Avicenna
5 - Hubbard
3 - Own definition
I create MSI installer using VS2005 for my application. For adding custom action in MSI installation , I add one exe in Custom action.
When install application using MSI, dialog box in my custom EXE is pop up,
and when I click by mouse on any button on dialogbox(custom.exe), installation done smothly, but when I press "Enter" key instead of mouse click, then one MSI message popup as
"There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor."
anybody know about this error.. please give some hint..
I am using Visual C++ V6 and am trying to change the comments property of a file.
I am using the code below but get an error message 0X80030002 - which by using 'Error Lookup' is %1 could not be found.
Can someone explain what I am doing wrong?
I am trying to change the properties of a .txt file
Assuming you're doing a ANSI build (not UNICODE), the above line is wrong. You should convert the ANSI string to a wide character one, for instance using MultiByteToWideChar [^] function (an example of usage here [^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke