InterlockedExchange64
- From: Leandro Oliveira <loliveira@xxxxxxxxx>
- Date: Mon, 13 Aug 2007 21:48:31 -0000
Hi all,
I am studying the InterlockedExchange64 function behavior and i think
I did sth wrong. IMO, the line that contains teh call
to ::DebugBreak() shouldn´t neve be executed. Am I right?
//////////////////////////////////////////////////////////////////////
volatile __int64 g;
unsigned __stdcall Check(void*)
{
__int64 t;
::InterlockedExchange64(&t, g);
while ((t == 0) ||
(t == 0xffffffffffffffff))
{
::InterlockedExchange64(&t, g);
}
::DebugBreak(); // THIS SHOULDN´T HAPPENS! SHOULD IT?
cout << std::hex << t;
return 0L;
}
int main(int argc, char **argv)
{
::_beginthreadex(NULL, 0, Check, NULL, 0, NULL);
__int64 v[] = {0, 0xffffffffffffffff};
int i = 0;
while (TRUE)
{
::InterlockedExchange64(&g, v[i %= 2, i++]);
}
return 0;
}
//////////////////////////////////////////////////
Best Regards.
.
- Follow-Ups:
- Re: InterlockedExchange64
- From: Ulrich Eckhardt
- Re: InterlockedExchange64
- From: Igor Tandetnik
- Re: InterlockedExchange64
- Prev by Date: Re: 'C' typedef enum
- Next by Date: Re: InterlockedExchange64
- Previous by thread: 'C' typedef enum
- Next by thread: Re: InterlockedExchange64
- Index(es):
Relevant Pages
|