Lines Matching refs:impl
431 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_put() local
433 mpp_assert(impl); in mpp_sthd_put()
434 mpp_assert(impl->ctx.thd == impl); in mpp_sthd_put()
435 mpp_assert(impl->status == MPP_STHD_UNINITED || impl->status == MPP_STHD_READY); in mpp_sthd_put()
437 mpp_sthd_deinit(impl); in mpp_sthd_put()
439 mpp_free(impl); in mpp_sthd_put()
444 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_get_status() local
446 CHECK_STHD(impl); in mpp_sthd_get_status()
448 return impl->status; in mpp_sthd_get_status()
453 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_get_name() local
455 CHECK_STHD(impl); in mpp_sthd_get_name()
457 return impl->name; in mpp_sthd_get_name()
462 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_get_idx() local
464 CHECK_STHD(impl); in mpp_sthd_get_idx()
466 return impl->idx; in mpp_sthd_get_idx()
476 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_setup() local
479 CHECK_STHD(impl); in mpp_sthd_setup()
481 pthread_mutex_lock(&impl->lock); in mpp_sthd_setup()
482 status = impl->status; in mpp_sthd_setup()
486 impl->func = func; in mpp_sthd_setup()
487 impl->ctx.ctx = ctx; in mpp_sthd_setup()
488 impl->status = func ? MPP_STHD_READY : MPP_STHD_UNINITED; in mpp_sthd_setup()
491 mpp_err("%s can NOT setup on %s\n", impl->name, state2str(status)); in mpp_sthd_setup()
494 pthread_mutex_unlock(&impl->lock); in mpp_sthd_setup()
496 CHECK_STHD(impl); in mpp_sthd_setup()
501 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_start() local
504 CHECK_STHD(impl); in mpp_sthd_start()
507 pthread_mutex_lock(&impl->lock); in mpp_sthd_start()
508 status = impl->status; in mpp_sthd_start()
511 mpp_sthd_create(impl); in mpp_sthd_start()
514 mpp_err("%s can NOT start on %s\n", impl->name, state2str(status)); in mpp_sthd_start()
517 pthread_mutex_unlock(&impl->lock); in mpp_sthd_start()
519 CHECK_STHD(impl); in mpp_sthd_start()
524 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_stop() local
527 CHECK_STHD(impl); in mpp_sthd_stop()
529 pthread_mutex_lock(&impl->lock); in mpp_sthd_stop()
530 status = impl->status; in mpp_sthd_stop()
535 pthread_cond_signal(&impl->cond); in mpp_sthd_stop()
538 mpp_err("%s can NOT stop on %s\n", impl->name, state2str(status)); in mpp_sthd_stop()
541 pthread_mutex_unlock(&impl->lock); in mpp_sthd_stop()
543 CHECK_STHD(impl); in mpp_sthd_stop()
548 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_stop_sync() local
551 CHECK_STHD(impl); in mpp_sthd_stop_sync()
553 pthread_mutex_lock(&impl->lock); in mpp_sthd_stop_sync()
554 status = impl->status; in mpp_sthd_stop_sync()
559 pthread_join(impl->thd, &dummy); in mpp_sthd_stop_sync()
560 impl->status = MPP_STHD_READY; in mpp_sthd_stop_sync()
563 mpp_err("%s can NOT stop on %s\n", impl->name, state2str(status)); in mpp_sthd_stop_sync()
566 pthread_mutex_unlock(&impl->lock); in mpp_sthd_stop_sync()
568 CHECK_STHD(impl); in mpp_sthd_stop_sync()
573 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_lock() local
575 CHECK_STHD(impl); in mpp_sthd_lock()
577 pthread_mutex_lock(&impl->lock); in mpp_sthd_lock()
582 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_unlock() local
584 CHECK_STHD(impl); in mpp_sthd_unlock()
586 pthread_mutex_unlock(&impl->lock); in mpp_sthd_unlock()
591 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_trylock() local
593 CHECK_STHD(impl); in mpp_sthd_trylock()
595 return pthread_mutex_trylock(&impl->lock); in mpp_sthd_trylock()
600 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_wait() local
602 CHECK_STHD(impl); in mpp_sthd_wait()
604 if (impl->status == MPP_STHD_RUNNING) in mpp_sthd_wait()
605 impl->status = MPP_STHD_WAITING; in mpp_sthd_wait()
607 pthread_cond_wait(&impl->cond, &impl->lock); in mpp_sthd_wait()
609 if (impl->status == MPP_STHD_WAITING) in mpp_sthd_wait()
610 impl->status = MPP_STHD_RUNNING; in mpp_sthd_wait()
615 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_signal() local
617 CHECK_STHD(impl); in mpp_sthd_signal()
619 pthread_cond_signal(&impl->cond); in mpp_sthd_signal()
624 MppSThdImpl *impl = (MppSThdImpl *)thd; in mpp_sthd_broadcast() local
626 CHECK_STHD(impl); in mpp_sthd_broadcast()
628 pthread_cond_broadcast(&impl->cond); in mpp_sthd_broadcast()
672 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_put() local
675 mpp_assert(impl); in mpp_sthd_grp_put()
676 mpp_assert(impl->status == MPP_STHD_UNINITED || impl->status == MPP_STHD_READY); in mpp_sthd_grp_put()
678 for (i = 0; i < impl->count; i++) { in mpp_sthd_grp_put()
679 MppSThdImpl *thd = &impl->thds[i]; in mpp_sthd_grp_put()
684 mpp_free(impl); in mpp_sthd_grp_put()
689 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_setup() local
692 mpp_assert(impl); in mpp_sthd_grp_setup()
694 pthread_mutex_lock(&impl->lock); in mpp_sthd_grp_setup()
695 status = impl->status; in mpp_sthd_grp_setup()
702 for (i = 0; i < impl->count; i++) { in mpp_sthd_grp_setup()
703 MppSThdImpl *thd = &impl->thds[i]; in mpp_sthd_grp_setup()
709 impl->status = next; in mpp_sthd_grp_setup()
712 mpp_err("%s can NOT setup on %s\n", impl->name, state2str(status)); in mpp_sthd_grp_setup()
715 pthread_mutex_unlock(&impl->lock); in mpp_sthd_grp_setup()
720 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_start() local
723 mpp_assert(impl); in mpp_sthd_grp_start()
726 pthread_mutex_lock(&impl->lock); in mpp_sthd_grp_start()
727 status = impl->status; in mpp_sthd_grp_start()
732 for (i = 0; i < impl->count; i++) in mpp_sthd_grp_start()
733 mpp_sthd_start(&impl->thds[i]); in mpp_sthd_grp_start()
735 impl->status = MPP_STHD_RUNNING; in mpp_sthd_grp_start()
738 mpp_err("%s can NOT start on %s\n", impl->name, state2str(status)); in mpp_sthd_grp_start()
741 pthread_mutex_unlock(&impl->lock); in mpp_sthd_grp_start()
746 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_stop() local
749 mpp_assert(impl); in mpp_sthd_grp_stop()
752 pthread_mutex_lock(&impl->lock); in mpp_sthd_grp_stop()
753 status = impl->status; in mpp_sthd_grp_stop()
759 impl->status = MPP_STHD_STOPPING; in mpp_sthd_grp_stop()
761 for (i = 0; i < impl->count; i++) { in mpp_sthd_grp_stop()
762 MppSThdImpl *thd = &impl->thds[i]; in mpp_sthd_grp_stop()
771 mpp_err("%s can NOT stop on %s\n", impl->name, state2str(status)); in mpp_sthd_grp_stop()
774 pthread_mutex_unlock(&impl->lock); in mpp_sthd_grp_stop()
779 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_stop_sync() local
782 mpp_assert(impl); in mpp_sthd_grp_stop_sync()
785 pthread_mutex_lock(&impl->lock); in mpp_sthd_grp_stop_sync()
786 status = impl->status; in mpp_sthd_grp_stop_sync()
793 for (i = 0; i < impl->count; i++) { in mpp_sthd_grp_stop_sync()
794 MppSThdImpl *thd = &impl->thds[i]; in mpp_sthd_grp_stop_sync()
799 impl->status = MPP_STHD_READY; in mpp_sthd_grp_stop_sync()
802 mpp_err("%s can NOT stop sync on %s\n", impl->name, state2str(status)); in mpp_sthd_grp_stop_sync()
805 pthread_mutex_unlock(&impl->lock); in mpp_sthd_grp_stop_sync()
810 MppSThdGrpImpl *impl = (MppSThdGrpImpl *)grp; in mpp_sthd_grp_get_each() local
813 mpp_assert(impl); in mpp_sthd_grp_get_each()
814 mpp_assert(idx >= 0 && idx < impl->count); in mpp_sthd_grp_get_each()
816 pthread_mutex_lock(&impl->lock); in mpp_sthd_grp_get_each()
817 ret = &impl->thds[idx]; in mpp_sthd_grp_get_each()
818 pthread_mutex_unlock(&impl->lock); in mpp_sthd_grp_get_each()