Changeset 9346e4a
- Timestamp:
- 09/10/15 16:40:56 (6 years ago)
- 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:
- d2df7c4
- Parents:
- c3cb9f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace_parallel.c
rf2066fa r9346e4a 1852 1852 // Check state from within the lock if we are going to change it 1853 1853 ASSERT_RET(pthread_mutex_lock(&libtrace->libtrace_lock), == 0); 1854 1855 /* If we are already paused, just treat this as a NOOP */ 1856 if (libtrace->state == STATE_PAUSED) { 1857 ASSERT_RET(pthread_mutex_unlock(&libtrace->libtrace_lock), == 0); 1858 return 0; 1859 } 1854 1860 if (!libtrace->started || libtrace->state != STATE_RUNNING) { 1855 1861 trace_set_err(libtrace,TRACE_ERR_BAD_STATE, "You must call trace_start() before calling trace_ppause()"); 1856 ASSERT_RET(pthread_mutex_unlock(&libtrace->libtrace_lock), == 0);1857 1862 return -1; 1858 1863 } … … 1921 1926 if (libtrace->config.debug_state) 1922 1927 fprintf(stderr, "Reporter thread is running, asking it to pause ..."); 1923 libtrace_message_t message = {0}; 1924 message.code = MESSAGE_DO_PAUSE; 1925 trace_message_thread(libtrace, &libtrace->reporter_thread, &message); 1926 // Wait for it to pause 1927 ASSERT_RET(pthread_mutex_lock(&libtrace->libtrace_lock), == 0); 1928 while (libtrace->reporter_thread.state == THREAD_RUNNING) { 1929 ASSERT_RET(pthread_cond_wait(&libtrace->perpkt_cond, &libtrace->libtrace_lock), == 0); 1930 } 1931 ASSERT_RET(pthread_mutex_unlock(&libtrace->libtrace_lock), == 0); 1928 if (pthread_equal(pthread_self(), libtrace->reporter_thread.tid)) { 1929 libtrace->combiner.pause(libtrace, &libtrace->combiner); 1930 thread_change_state(libtrace, &libtrace->reporter_thread, THREAD_PAUSED, true); 1931 1932 } else { 1933 libtrace_message_t message = {0}; 1934 message.code = MESSAGE_DO_PAUSE; 1935 trace_message_thread(libtrace, &libtrace->reporter_thread, &message); 1936 // Wait for it to pause 1937 ASSERT_RET(pthread_mutex_lock(&libtrace->libtrace_lock), == 0); 1938 while (libtrace->reporter_thread.state == THREAD_RUNNING) { 1939 ASSERT_RET(pthread_cond_wait(&libtrace->perpkt_cond, &libtrace->libtrace_lock), == 0); 1940 } 1941 ASSERT_RET(pthread_mutex_unlock(&libtrace->libtrace_lock), == 0); 1942 } 1932 1943 if (libtrace->config.debug_state) 1933 1944 fprintf(stderr, " DONE\n");
Note: See TracChangeset
for help on using the changeset viewer.