PJLIB thread/pools

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Note that pj_thread_destroy() does not stop a running thread, that needs to
be taken care of by app logic. You can use pj_thread_wait() to make sure
that the thread has exited before it is destroyed. Other than that I don't
have any idea.

By the way you can use strerror app from the samples to get the error
message from an error code.

Best regards,
 Benny

On Tue, May 22, 2012 at 10:04 PM, Tom Johnson <TJohnson at microaut.com> wrote:

> I am getting a 120012 from pj_thread_create  after about 380 threads, most
> of them have been terminated when I get the error.
>
> To create the thread:
>
> pj_thread_t *thread=NULL;
> pj_pool_t *threadPool=NULL;
>
> pj_status_t SocketHandler::startThread(pj_pool_factory *pf,int index) {
>    pj_status_t status;
>    char name[1024];
>
>    sprintf(name,"Client:%08x",index);
>
>    // create pool
>    threadPool=pj_pool_create(pf, name, PJ_THREAD_DEFAULT_STACK_SIZE,
> PJ_THREAD_DEFAULT_STACK_SIZE, NULL);
>    if (threadPool==NULL) {
>        PJ_LOG(3,(__FILE__,"Unable to create memory pool"));
>        return 1;
>    }
>    // create thread
>
> status=pj_thread_create(threadPool,name,threadProc,this,PJ_THREAD_DEFAULT_S
> TACK_SIZE,0,&thread);
>    if (status!=0) {
>        PJ_LOG(3,(__FILE__,"pj_thread_create returned %d",status)); //
> this is where the error is logged
>    }
>    return status;
> }
>
>
> When destroying the threads:
>  pj_status_t status;
>
>   status=pj_thread_destroy(thread);
>    if (status!=0) {
>        PJ_LOG(3,(__FILE__,"pj_thread_destroy returned %d",status));
>    }
>    pj_pool_release(threadPool);
>
>
> The errno is not in the PJ range given the header file, however, 12 is
> ENOMEM, so I presume it is some sort of memory issue.   This is using the
> 2.0 release of pjproject.   Am I doing something wrong?
>
>
> Notice: The information contained in this email and any attachments is
> confidential and may be subject to copyright or other intellectual property
> protection. If you are not the intended recipient, you are not authorized
> to use or disclose this information, and we request that you notify us by
> reply mail or telephone and delete the original message from your mail
> system.
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120523/194afb62/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux