thread->arg = arg;
thread->index = -1;
thread->yield = THREAD_YIELD_TIME_SLOT; /* default */
+ thread->ref = NULL;
/*
* So if the passed in funcname is not what we have
thread_add_fd (m->write, thread);
}
pthread_mutex_unlock (&thread->mtx);
- }
- if (t_ptr)
- {
- *t_ptr = thread;
- thread->ref = t_ptr;
+ if (t_ptr)
+ {
+ *t_ptr = thread;
+ thread->ref = t_ptr;
+ }
}
}
pthread_mutex_unlock (&m->mtx);
monotime(&thread->u.sands);
timeradd(&thread->u.sands, time_relative, &thread->u.sands);
pqueue_enqueue(thread, queue);
+ if (t_ptr)
+ {
+ *t_ptr = thread;
+ thread->ref = t_ptr;
+ }
}
pthread_mutex_unlock (&thread->mtx);
-
- if (t_ptr)
- {
- *t_ptr = thread;
- thread->ref = t_ptr;
- }
}
pthread_mutex_unlock (&m->mtx);
}
static void
vty_event (enum event event, int sock, struct vty *vty)
{
- struct thread *vty_serv_thread;
-
switch (event)
{
case VTY_SERV:
- vty_serv_thread = NULL;
- thread_add_read(vty_master, vty_accept, vty, sock, &vty_serv_thread);
- vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
+ vector_set_index (Vvty_serv_thread, sock, NULL);
+ thread_add_read(vty_master, vty_accept, vty, sock,
+ (struct thread **) &Vvty_serv_thread->index[sock]);
break;
#ifdef VTYSH
case VTYSH_SERV:
- vty_serv_thread = NULL;
- thread_add_read(vty_master, vtysh_accept, vty, sock, &vty_serv_thread);
- vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
+ vector_set_index (Vvty_serv_thread, sock, NULL);
+ thread_add_read(vty_master, vtysh_accept, vty, sock,
+ (struct thread **) &Vvty_serv_thread->index[sock]);
break;
case VTYSH_READ:
vty->t_read = NULL;