R
Richard Tobin
In a library I am writing, I want to use an errno-like mechanism
for error returns. The error would probably be represented as a
struct rather than just an integer.
I don't have any multi-threaded programs, but others may who want to
use my library. Most likely they'll be using a pthreads-compatible
threads system.
How can I best accommodate them? Presumably they will want the error
object to be in per-thread storage, so to set and retrieve it I should
provide functions or macros they can redefine. Ideally I'd like to be
able to build a single library (for each platform, using whatever
thread library is commonest there) that works with both threaded and
unthreaded applications, but I doubt that's possible.
-- Richard
for error returns. The error would probably be represented as a
struct rather than just an integer.
I don't have any multi-threaded programs, but others may who want to
use my library. Most likely they'll be using a pthreads-compatible
threads system.
How can I best accommodate them? Presumably they will want the error
object to be in per-thread storage, so to set and retrieve it I should
provide functions or macros they can redefine. Ideally I'd like to be
able to build a single library (for each platform, using whatever
thread library is commonest there) that works with both threaded and
unthreaded applications, but I doubt that's possible.
-- Richard