• Home
  • Raw
  • Download

Lines Matching refs:ts

103 static thread_slot_t ts[MAX_THREAD];  variable
184 APPL_TRACE_DEBUG2("ts[%d].used:%d", i, ts[i].used); in alloc_thread_slot()
185 if(!ts[i].used) in alloc_thread_slot()
187 ts[i].used = 1; in alloc_thread_slot()
199 ts[h].used = 0; in free_thread_slot()
214 ts[h].cmd_fdr = ts[h].cmd_fdw = -1; in btsock_thread_init()
215 ts[h].used = 0; in btsock_thread_init()
216 ts[h].thread_id = -1; in btsock_thread_init()
217 ts[h].poll_count = 0; in btsock_thread_init()
218 ts[h].callback = NULL; in btsock_thread_init()
219 ts[h].cmd_callback = NULL; in btsock_thread_init()
235 if((ts[h].thread_id = create_thread(sock_poll_thread, (void*)h)) != -1) in btsock_thread_create()
237 APPL_TRACE_DEBUG2("h:%d, thread id:%d", h, ts[h].thread_id); in btsock_thread_create()
238 ts[h].callback = callback; in btsock_thread_create()
239 ts[h].cmd_callback = cmd_callback; in btsock_thread_create()
253 asrt(ts[h].cmd_fdr == -1 && ts[h].cmd_fdw == -1); in init_cmd_fd()
254 if(socketpair(AF_UNIX, SOCK_STREAM, 0, &ts[h].cmd_fdr) < 0) in init_cmd_fd()
259 APPL_TRACE_DEBUG3("h:%d, cmd_fdr:%d, cmd_fdw:%d", h, ts[h].cmd_fdr, ts[h].cmd_fdw); in init_cmd_fd()
261 add_poll(h, ts[h].cmd_fdr, 0, SOCK_THREAD_FD_RD, 0); in init_cmd_fd()
265 if(ts[h].cmd_fdr != -1) in close_cmd_fd()
267 close(ts[h].cmd_fdr); in close_cmd_fd()
268 ts[h].cmd_fdr = -1; in close_cmd_fd()
270 if(ts[h].cmd_fdw != -1) in close_cmd_fd()
272 close(ts[h].cmd_fdw); in close_cmd_fd()
273 ts[h].cmd_fdw = -1; in close_cmd_fd()
291 if(ts[h].cmd_fdw == -1) in btsock_thread_add_fd()
299 if(ts[h].thread_id == pthread_self()) in btsock_thread_add_fd()
310 return send(ts[h].cmd_fdw, &cmd, sizeof(cmd), 0) == sizeof(cmd); in btsock_thread_add_fd()
319 if(ts[h].cmd_fdw == -1) in btsock_thread_post_cmd()
343 return send(ts[h].cmd_fdw, cmd_send, size_send, 0) == size_send; in btsock_thread_post_cmd()
352 if(ts[h].cmd_fdw == -1) in btsock_thread_wakeup()
358 return send(ts[h].cmd_fdw, &cmd, sizeof(cmd), 0) == sizeof(cmd); in btsock_thread_wakeup()
367 if(ts[h].cmd_fdw == -1) in btsock_thread_exit()
373 if(send(ts[h].cmd_fdw, &cmd, sizeof(cmd), 0) == sizeof(cmd)) in btsock_thread_exit()
375 pthread_join(ts[h].thread_id, 0); in btsock_thread_exit()
386 ts[h].poll_count = 0; in init_poll()
387 ts[h].thread_id = -1; in init_poll()
388 ts[h].callback = NULL; in init_poll()
389 ts[h].cmd_callback = NULL; in init_poll()
392 ts[h].ps[i].pfd.fd = -1; in init_poll()
393 ts[h].psi[i] = -1; in init_poll()
424 poll_slot_t* ps = ts[h].ps; in add_poll()
430 asrt(ts[h].poll_count < MAX_POLL); in add_poll()
440 asrt(ts[h].poll_count < MAX_POLL); in add_poll()
442 ++ts[h].poll_count; in add_poll()
452 --ts[h].poll_count; in remove_poll()
467 int fd = ts[h].cmd_fdr; in process_cmd_sock()
482 asrt(ts[h].cmd_callback); in process_cmd_sock()
483 if(ts[h].cmd_callback) in process_cmd_sock()
484 ts[h].cmd_callback(fd, cmd.type, cmd.flags, cmd.user_id); in process_cmd_sock()
496 asrt(count <= ts[h].poll_count); in process_data_sock()
498 for( i= 1; i < ts[h].poll_count; i++) in process_data_sock()
502 int ps_i = ts[h].psi[i]; in process_data_sock()
503 asrt(pfds[i].fd == ts[h].ps[ps_i].pfd.fd); in process_data_sock()
504 uint32_t user_id = ts[h].ps[ps_i].user_id; in process_data_sock()
505 int type = ts[h].ps[ps_i].type; in process_data_sock()
520 remove_poll(h, &ts[h].ps[ps_i], ts[h].ps[ps_i].flags); in process_data_sock()
523 … remove_poll(h, &ts[h].ps[ps_i], flags); //remove the monitor flags that already processed in process_data_sock()
525 ts[h].callback(pfds[i].fd, type, flags, user_id); in process_data_sock()
535 asrt(ts[h].poll_count <= MAX_POLL); in prepare_poll_fds()
536 memset(pfds, 0, sizeof(pfds[0])*ts[h].poll_count); in prepare_poll_fds()
537 while(count < ts[h].poll_count) in prepare_poll_fds()
542 ps_i, MAX_POLL, count, ts[h].poll_count); in prepare_poll_fds()
545 if(ts[h].ps[ps_i].pfd.fd >= 0) in prepare_poll_fds()
547 pfds[pfd_i] = ts[h].ps[ps_i].pfd; in prepare_poll_fds()
548 ts[h].psi[pfd_i] = ps_i; in prepare_poll_fds()
563 int ret = poll(pfds, ts[h].poll_count, -1); in sock_poll_thread()
574 asrt(pfds[0].fd == ts[h].cmd_fdr); in sock_poll_thread()
589 ts[h].thread_id = -1; in sock_poll_thread()