Sometimes c++ plays me big time. I really can't think of why this does/doesn't work and I'd be happy if any of you knew.
I call this function once every second on a thread.
This code WORKS (prints what is on the list being iterated):
void DeltaList::print()
{
pthread_mutex_lock (&mutex);
printf("\n");
list<Delta*>::iterator it;
for(it=deltas.begin(); it!=deltas.end(); it++)
{
printf("%d ", (int) (*it)->timeleft);
}
pthread_mutex_unlock (&mutex);
}
This one DOESN'T (nothing is printed):
void DeltaList::print()
{
pthread_mutex_lock (&mutex);
//printf("\n");
list<Delta*>::iterator it;
for(it=deltas.begin(); it!=deltas.end(); it++)
{
printf("%d ", (int) (*it)->timeleft);
}
pthread_mutex_unlock (&mutex);
}
So... ?