Different places scheduling the same thread should use the same
semantics and thread type. Additionally providing the back reference
here makes sure we only schedule the job once and avoids flooding the
event queue with jobs to process an empty buffer.
{
// more work to do, come back later
if (peer->ibuf->count > 0)
- thread_add_event(bm->master, bgp_process_packet,
- peer, 0, NULL);
+ thread_add_timer_msec(
+ bm->master, bgp_process_packet, peer, 0,
+ &peer->t_process_packet);
}
pthread_mutex_unlock(&peer->io_mtx);
}