|
termal wrote: ...to ensure that only one thread can use this variable, for manipulations!
Have you considered a synchronization object such as a critical section or a mutex?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
thanks for reply,yes i use critical section, but only in one function,
is it posible to protect one variable programwide,
so wenn one function use vector other functions have to wait until this vector is free?
Example:
FunktionOne() // use vector
FunktionTwo() // must wait because vector is in use by FunktionOne()
Is that posible or i want to much?
with best regards
termal
|
|
|
|
|
termal wrote: is it posible to protect one variable programwide,
so wenn one function use vector other functions have to wait until this vector is free?
Example:
FunktionOne() // use vector
FunktionTwo() // must wait because vector is in use by FunktionOne()
Is that posible or i want to much?
That almost sounds like an event .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
termal wrote: is it posible to protect environment variable in multithreaded application
Absolutely. The standard answer, is a mutex. Mutual exclusion prevents anything other than one thread from executing through a region of code. A primary way is with CriticalSections. However, it is important to note that you will be accessing the region of code in linear space. That is, you will reduce the code execution for that task to single threaded operation, so you want to make sure it is not your primary occupation of time.
There are other ways, google lock-free algorithms. A good CAS or CAS2 will give you the base structure to build a non-blocking synchronization system, but you will have to think on it. Qt uses something called "implicit sharing" meaning you want to share read access with all threads all the time, but you want to lock it for writing.
You can also use record locking, if you understand how to use a CAS or CAS2 step properly which will allow you to add/change a single vector item and block that one item from reading until the update step is completed, but allow all other reads to all other vector items to continue without delays.
You can also just pull down Intel's thread building blocks and use their threadsafe vector and be done with it all. http://www.threadingbuildingblocks.org/[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Hi,
I want to extract a zipped file which is stored in Oracle DB table as HUGEBLOB. I want to modify that one and put it back. The file extension is .xml.gz. I want to bring this .xml.gz file using my application based on MFC.
Can any body give me any suggestion/help on how to get the file? I dont want to get te data into any buffer. I want to get the physical zipped file.
Can anyone help me out?
Thanks
Sourav
-- modified at 15:40 Monday 10th September, 2007
|
|
|
|
|
Found this article
<ahref="http: www.codeproject.com="" useritems="" codecave.asp#introduction0"="">http://www.codeproject.com/useritems/codecave.asp#Introduction0[^]
Which had me very excited because I thought it was the answer to my problem.
But soon I realized I just dont have the skill to implement it.
I am lookin (Praying) for someone to take pity on me and show me how to do it or do it for me (PLEASE).
Here are the details (Sry its lenghty).
I co-own a gaming Halo clan.
We operate 16 dedicated online servers.
When naming the servers we are permited 64 spaces.
Thru time people have found that by using Alt Codes in the game name they can move to the top of the online listing as it precedes the alpha numerical listing.
Now some people have found a way to circumvent that as well. By deleteinfg the naming of the server in the .ini file the games .exe file defaults to a generic "HALO" nameing. Then by hex editing that loacation they can rename the server.
The problem in this method is that we are now limited to onlt 26 spaces for naming. I need more. The names and descriptions of our serves are about 40 spaces.
I have been able to identify the starting and ending byte of the location in the .exe file. There is alos plenty of unused space in the program. I was hoping to add a call and return to one of those locations so I can store the longer name.
won't someone please help me?
-- modified at 10:40 Wednesday 5th September, 2007
|
|
|
|
|
selkov wrote: ...or do it for me (PLEASE).
On a volunteer site? Most of us here have paying jobs, and only provide help when we have time.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well I have exahusted all the options I have. If you have any other ideas please feel free to share them with me.
I might be wrong but I assume if a person knew how to do this it would not be a difficult project.
|
|
|
|
|
Hi,
Ultimate Grid supports Multifonts OnSetup().
But how can I use Editing cell (multiline + multifont)as
CRichEditCtrl class with user-defined actions?
Thanks
|
|
|
|
|
I included Window Mouse Hook in my app, when compiled I get this:
"error C2065: 'WH_MOUSE_LL' : undeclared identifier"
???
g_hMouseHook = SetWindowsHookEx(WH_MOUSE_LL,MouseProc,GetModuleHandle(NULL),0);
|
|
|
|
|
Did you bother looking in winuser.h for why:
#if (_WIN32_WINNT >= 0x0400)
#define WH_KEYBOARD_LL 13
#define WH_MOUSE_LL 14
#endif // (_WIN32_WINNT >= 0x0400)
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
can any body suggest me some code to set the system time?
please help.
thanks in advance.
|
|
|
|
|
SetSystemTime
Wasn't too hard
You need special privileges, though.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
And see GetSystemTime() and SetLocalTime() .
|
|
|
|
|
Hi all,
I want to convert my CString string/variable into lowercase characters....Is there any API for doing so.........
thanks in advance
|
|
|
|
|
why?
dont you know about str.MakeLower(); function,
it is as simple as that.
if that is not working for you,
then i can suggest something else.
-- modified at 8:08 Wednesday 5th September, 2007
|
|
|
|
|
i m working in mfc so this function is not available there
|
|
|
|
|
CString is from MFC.
so follow this.
CString str;
str="HELLO";
str.MakeLower();
now this should work.
|
|
|
|
|
if your problem is solved, please indicate the same in your main subject by prefixing [SOLVED] to your subject.
|
|
|
|
|
Can you help me.
Help to be going to create Virtual IP using "iphlp" libarary raise just there is example code using c++
wait for your advice.
thank you.
ps : thanks is add "iphlp" library fils(iphlp.h , iphlp.dll ...)
|
|
|
|
|
There is no need to repeat your question. When and if somebody is able to help you, they will reply to your origional post!
|
|
|
|
|
I think I saw your question 6 hours ago why but you asked again?
|
|
|
|
|
Hi All
I have a confusion related to global and local variables...
why global variables are initialized to zero whereas local variables are not...
What is the reason behind this.
Please suggest me the answer.
Thanks & Regards
|
|
|
|
|
Global variables can be used within any function from anywhere within your code, local variables can only be used within scope that they were created ( usualy a single function ). It's good practice and reduces many bugs if you initialize all your variables when you create them, regardless of what the books tell you.
|
|
|
|
|
thanks WalderMort
it is fine that we should initialize each var while creating it,
but wondering that why global variables are initialized to zero by compiler whereas local variables are not..
Please help to understand the logic
Thanks & Regards
|
|
|
|