Prevent delayed astdb syncs.

The syncing thread sleeps for a second before waiting to be
told to attempt to sync again. If a signal were sent during this
sleeping period, we would end up having to wait until the next
sync signal occurred in order to sync up the astdb.

This code rearrangement also ensures that any pending transactions
will be synced prior to Asterisk shutting down.

Patches: db_sync.patch by John Hardin (License #6512)



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/11@410556 f38db490-d61c-443f-a65b-d21fe96a405b