G
Guest
I have a few global variables and a function that gets called multiple times
to complete a single transaction and uses the variables. The function gets
different notifications. When the function receives a final notification,
that where I need to release the global variables. I don't have control over
when the function gets called because the function is called by the system.
How can I block the function so that it can only be entered after the global
variables are released? Here is my code.
string sHeader;
string sData;
DWORD WINAPI __stdcall MyProc(...)
{
switch (NotificationType)
{
case NOTIFICATION1:
{
// do something here with sHeader and sData
...
break;
}
case NOTIFICATION2:
{
// do something here with sHeader and sData
...
break;
}
case NOTIFICATION3:
{
// release here
...
break;
}
}
}
to complete a single transaction and uses the variables. The function gets
different notifications. When the function receives a final notification,
that where I need to release the global variables. I don't have control over
when the function gets called because the function is called by the system.
How can I block the function so that it can only be entered after the global
variables are released? Here is my code.
string sHeader;
string sData;
DWORD WINAPI __stdcall MyProc(...)
{
switch (NotificationType)
{
case NOTIFICATION1:
{
// do something here with sHeader and sData
...
break;
}
case NOTIFICATION2:
{
// do something here with sHeader and sData
...
break;
}
case NOTIFICATION3:
{
// release here
...
break;
}
}
}