Unix Programming - POSIX based Timer class, occasional crash

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2005 > POSIX based Timer class, occasional crash





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author POSIX based Timer class, occasional crash
usenet@sta.samsung.com

2005-09-28, 6:02 pm

Here's what I've got.

I've got a Timer class and a TimerClient base class. The Timer class
maintains a mapping between the timer-id and information such as the
number of times to fire the timer, timer attributes, a pointer to the
client, and a pointer to a client specific "payload" that gets
delivered to the client with the timeout message. The Timer class is a
singleton, and it's a wrapper for POSIX timer functions
(timer_create, timer_settime, timer_delete). It's access to its
internal map is controlled via a pthread_mutex.

Every once in a while an application that is using the timer crashes,
and I am unable to figure out what might be happening. Any insight
will be appreciated.

I have posted the source to comp.sources.d

Thanks,
Gus

Maxim Yegorushkin

2005-09-29, 2:55 am


usenet@sta.samsung.com wrote:
> Here's what I've got.
>
> I've got a Timer class and a TimerClient base class. The Timer class
> maintains a mapping between the timer-id and information such as the
> number of times to fire the timer, timer attributes, a pointer to the
> client, and a pointer to a client specific "payload" that gets
> delivered to the client with the timeout message. The Timer class is a
> singleton, and it's a wrapper for POSIX timer functions
> (timer_create, timer_settime, timer_delete). It's access to its
> internal map is controlled via a pthread_mutex.
>
> Every once in a while an application that is using the timer crashes,
> and I am unable to figure out what might be happening. Any insight
> will be appreciated.


Wild guess: Timer calls back a TimerClient after it has already been
destroyed.

Did you try opening the crash dump with gdb to see where and why it
crashed?

> I have posted the source to comp.sources.d


It would be more convenient if you posted it here.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com