#include <pthread.h>
#pragma pack(1)
struct test_t
{
short b;
char c;
unsigned int a;
};
#pragma pack()
struct test_t test;
unsigned int n = 0xffffffff;
void* set( void* arg )
{
while (1)
{
(&test)->a = 0;
(&test)->a = n;
}
}
void* get( void* arg )
{
while (1)
{
unsigned int n1 = 0;
n1 = (&test)->a;
if (n1 == 0) continue;
if (n1 != 0xffffffff )
printf("ok%x\n", n1);
}
}
int main( int argc , char **argv )
{
pthread_t thread_id;
int i;
for (i = 0; i < 1; i ++)
{
pthread_create( &thread_id , NULL , set , ( void* )NULL );
}
for (i = 0; i < 1; i ++)
{
pthread_create( &thread_id , NULL , get , ( void* )NULL );
}
while(1) sleep(10);
return 0;
}