In the C/C++ RTL manual; hsearch(); 3.434.3 General description; I see:

Threading Behavior: The hcreate() function allocates a piece of storage for use 
as the hash table. This storage is not exposed to the user, and is referred to 
by all threads. In other words, these functions operate on one hash table 
global to the process. The library serializes access to the table and attendant 
data across threads using an internal mutex. 

POSIX says much the same, but not so clearly.  So:

o I can have only one symbol table; everything goes in it.

o If I write a utility subroutine, I don't know what my caller might
  be doing; I might step on it.

Grrr.  How could they!?  What's an alternative?  I'd like to avoid
quadratic behavior.   The tsearch() family is nicer -- it lets me
choose a root.  But it doesn't balance the tree -- its worst case
is when the entries arrive sorted, which mine almost are.

My colleague is doing a linear search of a few hundred entries.
It's plenty fast: computers are that way nowadays.  But not
esthetic.

Thanks,
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to