Merge pull request #10228 from kpayson64/gpr_assert_thd

Assert on thread creation
pull/10262/head
kpayson64 8 years ago committed by GitHub
commit 8e2713ec31
  1. 2
      src/core/lib/iomgr/ev_poll_posix.c
  2. 4
      src/core/lib/iomgr/executor.c
  3. 2
      src/core/lib/profiling/basic_timers.c

@ -1421,7 +1421,7 @@ static int cvfd_poll(struct pollfd *fds, nfds_t nfds, int timeout) {
g_cvfds.pollcount++; g_cvfds.pollcount++;
opt = gpr_thd_options_default(); opt = gpr_thd_options_default();
gpr_thd_options_set_detached(&opt); gpr_thd_options_set_detached(&opt);
gpr_thd_new(&t_id, &run_poll, pargs, &opt); GPR_ASSERT(gpr_thd_new(&t_id, &run_poll, pargs, &opt));
// We want the poll() thread to trigger the deadline, so wait forever here // We want the poll() thread to trigger the deadline, so wait forever here
gpr_cv_wait(pollcv, &g_cvfds.mu, gpr_inf_future(GPR_CLOCK_MONOTONIC)); gpr_cv_wait(pollcv, &g_cvfds.mu, gpr_inf_future(GPR_CLOCK_MONOTONIC));
if (gpr_atm_no_barrier_load(&pargs->status) == COMPLETED) { if (gpr_atm_no_barrier_load(&pargs->status) == COMPLETED) {

@ -115,8 +115,8 @@ static void maybe_spawn_locked() {
/* All previous instances of the thread should have been joined at this point. /* All previous instances of the thread should have been joined at this point.
* Spawn time! */ * Spawn time! */
g_executor.busy = 1; g_executor.busy = 1;
gpr_thd_new(&g_executor.tid, closure_exec_thread_func, NULL, GPR_ASSERT(gpr_thd_new(&g_executor.tid, closure_exec_thread_func, NULL,
&g_executor.options); &g_executor.options));
g_executor.pending_join = 1; g_executor.pending_join = 1;
} }

@ -218,7 +218,7 @@ void gpr_timers_set_log_filename(const char *filename) {
static void init_output() { static void init_output() {
gpr_thd_options options = gpr_thd_options_default(); gpr_thd_options options = gpr_thd_options_default();
gpr_thd_options_set_joinable(&options); gpr_thd_options_set_joinable(&options);
gpr_thd_new(&g_writing_thread, writing_thread, NULL, &options); GPR_ASSERT(gpr_thd_new(&g_writing_thread, writing_thread, NULL, &options));
atexit(finish_writing); atexit(finish_writing);
} }

Loading…
Cancel
Save