context, threads, and both

John Rudd jrudd at
Thu Jun 2 16:56:05 EDT 2005

On May 31, 2005, at 20:28, Ken Raeburn wrote:

>> 2) I seem to recall that kerberos libraries are not thread safe.  Is 
>> that accurate?  If I decide to multi-thread this program, do I need 
>> to wrap the kerberos calls with mutex's?
>> 3) What about the context and each thread?  Does each thread need its 
>> own context?  (does the "is or is not thread-safe" aspect depend upon 
>> whether or not each thread has its own context?)
> That's the idea, yes -- calls can be done in different threads as long 
> as they use different contexts.  For simple data types exported in the 
> header file, like the principal structure, we don't have any locking, 
> so they're only safe to use in multiple threads at once if all of the 
> uses only read the structure contents (and yeah, that's not really 
> well documented anywhere).

So, if each one keeps its own principle, creds, and context data 
separate, all should be good?

> P.S.  This is all assuming you're using a fairly current release.  The 
> 1.2 series had none of the thread safety support, for example.  Oh, 
> and I'm talking about the krb5 and gssapi libraries -- gssrpc hasn't 
> been done, and krb4 isn't going to be.

We're still in 1.2.x, so I probably wont bother trying to multi-thread 
my program until later this summer (when we upgrade our kerberos 


More information about the krbdev mailing list