LWN.net Logo

libabc: a demonstration library for kernel developers

libabc: a demonstration library for kernel developers

Posted Nov 2, 2011 20:58 UTC (Wed) by aliguori (subscriber, #30636)
In reply to: libabc: a demonstration library for kernel developers by quotemstr
Parent article: libabc: a demonstration library for kernel developers

> This piece of advice is confusing. I think the author meant to make
> libraries thread-agnostic: don't bend over backwards to accommodate
> access to the same data from multiple threads, but don't unnecessarily
> couple different pieces of data either.

My take is simply don't use global variables or anything that would break a threaded application. Return contexts such that when you hold a lock around a context, things work as expected.


(Log in to post comments)

libabc: a demonstration library for kernel developers

Posted Nov 3, 2011 21:55 UTC (Thu) by nix (subscriber, #2304) [Link]

I'd say that you can use global variables even in something supporting unlimited numbers of contexts, but if you do they should be threadsafe, not just thread-agnostic. (This is sometimes useful for cross-context caching and the like.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds