Changeset 04bf7c5 for lib/trace.c


Ignore:
Timestamp:
01/20/15 09:44:16 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
75e088f, fed9152
Parents:
b73407f
Message:

Remove unused sliding window code.
Refactored pstart and added some proper error handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rb73407f r04bf7c5  
    261261       
    262262        /* Parallel inits */
    263         // libtrace->libtrace_lock
    264         // libtrace->perpkt_cond;
     263        ASSERT_RET(pthread_mutex_init(&libtrace->libtrace_lock, NULL), == 0);
     264        ASSERT_RET(pthread_cond_init(&libtrace->perpkt_cond, NULL), == 0);
    265265        libtrace->state = STATE_NEW;
    266266        libtrace->perpkt_queue_full = false;
     
    273273        libtrace_zero_thread(&libtrace->reporter_thread);
    274274        libtrace_zero_thread(&libtrace->keepalive_thread);
    275         libtrace_zero_slidingwindow(&libtrace->sliding_window);
    276275        libtrace->reporter_thread.type = THREAD_EMPTY;
    277276        libtrace->perpkt_thread_count = 0;
     
    381380       
    382381        /* Parallel inits */
    383         // libtrace->libtrace_lock
    384         // libtrace->perpkt_cond;
     382        ASSERT_RET(pthread_mutex_init(&libtrace->libtrace_lock, NULL), == 0);
     383        ASSERT_RET(pthread_cond_init(&libtrace->perpkt_cond, NULL), == 0);
    385384        libtrace->state = STATE_NEW; // TODO MAYBE DEAD
    386385        libtrace->perpkt_queue_full = false;
     
    393392        libtrace_zero_thread(&libtrace->reporter_thread);
    394393        libtrace_zero_thread(&libtrace->keepalive_thread);
    395         libtrace_zero_slidingwindow(&libtrace->sliding_window);
    396394        libtrace->reporter_thread.type = THREAD_EMPTY;
    397395        libtrace->perpkt_thread_count = 0;
     
    634632 */
    635633DLLEXPORT void trace_destroy(libtrace_t *libtrace) {
    636     int i;
     634        int i;
    637635        assert(libtrace);
    638636
    639         /* destroy any packet that are still around */
     637        ASSERT_RET(pthread_mutex_destroy(&libtrace->libtrace_lock), == 0);
     638        ASSERT_RET(pthread_cond_destroy(&libtrace->perpkt_cond), == 0);
     639
     640        /* destroy any packets that are still around */
    640641        if (libtrace->state != STATE_NEW && libtrace->first_packets.packets) {
    641642                for (i = 0; i < libtrace->perpkt_thread_count; ++i) {
     
    687688DLLEXPORT void trace_destroy_dead(libtrace_t *libtrace) {
    688689        assert(libtrace);
     690
     691        ASSERT_RET(pthread_mutex_destroy(&libtrace->libtrace_lock), == 0);
     692        ASSERT_RET(pthread_cond_destroy(&libtrace->perpkt_cond), == 0);
    689693
    690694        /* Don't call pause_input or fin_input, because we should never have
Note: See TracChangeset for help on using the changeset viewer.