Thread Safety (And Reading Headers)

CM
Colin Morelli
Thu, Apr 21, 2016 2:23 PM

Hey all,

New to PJSIP here. I have two questions:

  1. Regarding thread safety, the only thing I have found is that memory pool
    allocation is not thread safe. If I'm doing no manual pool allocation in
    my application, is it safe to use the standard pjsua API methods across
    multiple threads? It seems like all of the relevant bits are acquiring the
    PJSUA lock, so I assume so, but I wanted to check on that.

  2. It's been a while since I have touched anything C, so that's probably
    what's slowing me down here, but is there any way to just get a list of all
    message headers with string keys and values from an instance of pjsip_msg?
    I suppose I can iterate the list and call print_on for each, but I believe
    that requires allocating a buffer from the pool which then brings up the
    previously mentioned threading issues. Any ideas here?

Thanks in advance for your help.

Best,
Colin

Hey all, New to PJSIP here. I have two questions: 1. Regarding thread safety, the only thing I have found is that memory pool allocation is *not* thread safe. If I'm doing no manual pool allocation in my application, is it safe to use the standard pjsua API methods across multiple threads? It seems like all of the relevant bits are acquiring the PJSUA lock, so I assume so, but I wanted to check on that. 2. It's been a while since I have touched anything C, so that's probably what's slowing me down here, but is there any way to just get a list of all message headers with string keys and values from an instance of pjsip_msg? I suppose I can iterate the list and call print_on for each, but I believe that requires allocating a buffer from the pool which then brings up the previously mentioned threading issues. Any ideas here? Thanks in advance for your help. Best, Colin