Le 06/07/11 20:35, Rui Maciel a écrit :
Nonetheless, the idea of adopting some proprietary library while
intentionally ignoring a widely established international standard that
cover threads in C, exists for over a decade and was designed specifically
with portability in mind is incomprehensible. It leaves me wondering what
they had in mind when they screwed this up.
Rui Maciel
The problem is that (as with many docs of libraries) they do not explain
the CONCEPTS at all.
For instance, the library describes an "xtime" structure that holds
the time in nanoseconds. OK, very useful but absolutely NO functions
are given to convert to/from other time formats already in use in the
current standard like time_t into this new tye that becomes one of the
basic types of the language!
The specs are completely vague:
<quote>
xtime
.... is a structure type that holds a time specified in seconds and
nanoseconds.
<end quote>
Seconds since when? What is the start of that clock? The last
reboot? Jan 1, 1970? or another time?
Nothing, not a word about that.
Then, this type is used in functions like:
<quote>
The cnd_timedwait function atomically unlocks the mutex pointed to by
mtx and endeavors to block until the condition variable pointed to by
cond is signaled by a call to cnd_signal or to cnd_broadcast, or until
after the time specified by the xtime object pointed to by xt.
<end quote>
"After the time" supposes that
a) the time is specified as zero from the moment that function is called
b) the time is specified as the time of the wall clock, i.e. as the
time of the day.
Since that structure is defined as
struct xtime { time_t sec; long nsec;}
you can reasonably suppose that the time_t part is the same as the OTHER
time_t's floating around in other parts of the standard.
Or you can just assume that since the thread timeout is significant
only beginning at the moment the call is made it means that a
value of 1 in the sec member means & timeout of one second and not
midnight and 1 second...
All this is nowhere SPECIFIED.
I sent a detailed critique of this mibrary 2 years ago in comp.std.c
The same errors are STILL THERE!!!