summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-11-21 14:12:01 +0000
committerBenny Prijono <bennylp@teluu.com>2007-11-21 14:12:01 +0000
commit5931dc59c08af2cf1f23518f700e9107effa9e59 (patch)
tree82f144feae2c2eb35b1f65f9edc156365152e347 /pjmedia
parent7cea28ab2a2d6dadb0ef3aaa6a3194e45f98cba5 (diff)
Ticket #417: added pjlib API to retrieve the native thread handle from pj_thread_t
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1589 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/endpoint.h20
-rw-r--r--pjmedia/src/pjmedia/endpoint.c22
2 files changed, 42 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/endpoint.h b/pjmedia/include/pjmedia/endpoint.h
index feaaa93f..e4521efd 100644
--- a/pjmedia/include/pjmedia/endpoint.h
+++ b/pjmedia/include/pjmedia/endpoint.h
@@ -87,6 +87,26 @@ PJ_DECL(pj_ioqueue_t*) pjmedia_endpt_get_ioqueue(pjmedia_endpt *endpt);
/**
+ * Get the number of worker threads on the media endpoint
+ *
+ * @param endpt The media endpoint instance.
+ * @return The number of worker threads on the media endpoint
+ */
+PJ_DECL(unsigned) pjmedia_endpt_get_thread_count(pjmedia_endpt *endpt);
+
+/**
+ * Get a reference to one of the worker threads of the media endpoint
+ *
+ * @param endpt The media endpoint instance.
+ * @param index The index of the thread: 0<= index < thread_cnt
+ *
+ * @return pj_thread_t or NULL
+ */
+PJ_DECL(pj_thread_t*) pjmedia_endpt_get_thread(pjmedia_endpt *endpt,
+ unsigned index);
+
+
+/**
* Request the media endpoint to create pool.
*
* @param endpt The media endpoint instance.
diff --git a/pjmedia/src/pjmedia/endpoint.c b/pjmedia/src/pjmedia/endpoint.c
index d9296f1c..dbeefe7f 100644
--- a/pjmedia/src/pjmedia/endpoint.c
+++ b/pjmedia/src/pjmedia/endpoint.c
@@ -226,6 +226,28 @@ PJ_DEF(pj_ioqueue_t*) pjmedia_endpt_get_ioqueue(pjmedia_endpt *endpt)
return endpt->ioqueue;
}
+/**
+ * Get the number of worker threads in media endpoint.
+ */
+PJ_DEF(unsigned) pjmedia_endpt_get_thread_count(pjmedia_endpt *endpt)
+{
+ PJ_ASSERT_RETURN(endpt, 0);
+ return endpt->thread_cnt;
+}
+
+/**
+ * Get a reference to one of the worker threads of the media endpoint
+ */
+PJ_DEF(pj_thread_t*) pjmedia_endpt_get_thread(pjmedia_endpt *endpt,
+ unsigned index)
+{
+ PJ_ASSERT_RETURN(endpt, NULL);
+ PJ_ASSERT_RETURN(index < endpt->thread_cnt, NULL);
+
+ /* here should be an assert on index >= 0 < endpt->thread_cnt */
+
+ return endpt->thread[index];
+}
/**
* Worker thread proc.