Make object static on becoming asleep

Hi All! I need to make an object static as soon as it starts sleeping. One way to do this would be to get notified upon the object becoming asleep. I couldn't find anything on that. Or is there any other way? Many thanks!
Vitaly
From looking in the sources there seem to be no notification or anything like that in the "put to sleep" code (from java port):

Code:
         if (minSleepTime >= Settings.timeToSleep) {
            for (int i = 0; i < m_bodyCount; ++i) {
               final Body b = m_bodies[i];
               b.m_flags |= Body.e_sleepFlag;
               // thanks Edge!
               b.m_linearVelocity.setZero(); // no new creation = new Vec2(0.0f, 0.0f);
               b.m_angularVelocity = 0.0f;
            }
         }

Seems the only option is to modify the library?
I scanned the manual and sources once again - def there is nothing like a SleepListener. Apart from modifying the library, another way to achieve that would be iterating through ALL world objects every x frames and marking sleeping objects static I guess? Erin?
I do not want to add a sleep listener. It is not commonly needed.

You likely process each object anyway because you must draw them. So just check if they are sleeping.
Many thanks for confirming!

Original thread: https://box2d.org/forum/viewtopic.php?t=5706