Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Multithreading and compatibility library (libconfig)

Reply
Thread Tools

Multithreading and compatibility library (libconfig)

 
 
Muffinman
Guest
Posts: n/a
 
      01-23-2013
Hello all,

I have a question regarding a library for reading configuration files,
libconfig. I think I'm going slightly off-topic here, but I have not
found a better place for this question.

While this library does not support multithreading, I do need to access
the containing information from two threads. I do the following: I load
the configuration file once before I multithread. I never change the
configuration data. I do retrieve information from it and this can
happen by two threads at the same time.

It's website states the following ->
http://www.hyperrealm.com/libconfig/...eading-Issues:
Libconfig is fully reentrant; the functions in the library do not make
use of global variables and do not maintain state between successive
calls. Therefore two independent configurations may be safely
manipulated concurrently by two distinct threads.

If it doesn't use global variables, or maintain state between successive
calls, shouldn't it be safe to request data with one of its functions,
as long as it doesn't reload or write/modify/save data? I could imagine
that some pointers could get mixed up with two concurrent calls
searching for some data. But since it doesn't use global variables or
maintain state between successive calls, I don't see how this can happen.

I hope someone can give me some clarity on this. Below I have some more
notes on libconfig and multithreading.

Kind regards, Maarten

ps. some additional info supplied by the developer:

Libconfig is not thread-safe. The library is not aware of the presence
of threads and knows nothing about the host system's threading model.
Therefore, if an instance of a configuration is to be accessed from
multiple threads, it must be suitably protected by synchronization
mechanisms like read-write locks or mutexes; the standard rules for safe
multithreaded access to shared data must be observed.

Libconfig is not async-safe. Calls should not be made into the library
from signal handlers, because some of the C library routines that it
uses may not be async-safe.

Libconfig is not guaranteed to be cancel-safe. Since it is not aware of
the host system's threading model, the library does not contain any
thread cancellation points. In most cases this will not be an issue for
multithreaded programs. However, be aware that some of the routines in
the library (namely those that read/write configurations from/to files
or streams) perform I/O using C library routines which may potentially
block; whether or not these C library routines are cancel-safe depends
on the host system.
 
Reply With Quote
 
 
 
 
James Kuyper
Guest
Posts: n/a
 
      01-23-2013
On 01/23/2013 07:16 AM, Muffinman wrote:
> Hello all,
>
> I have a question regarding a library for reading configuration files,
> libconfig. I think I'm going slightly off-topic here, but I have not
> found a better place for this question.

....
> http://www.hyperrealm.com/libconfig/...eading-Issues:


I'd recommend sending questions to
<http://www.hyperrealm.com/feedback.html>
--
James Kuyper
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about sstream compatibility with standard library on FreeBSD Charles Prince C++ 0 12-06-2004 11:32 AM
Multithreading library Brzezi C++ 2 10-20-2004 11:22 AM
[OT] Naming Conventions: Question of Style, or Library Compatibility? bartek C++ 6 04-05-2004 02:38 PM
Porting library from C to C++ but must maintain backwards compatibility Sonny C++ 7 02-10-2004 06:50 PM
multithreading with an external library David Garamond Ruby 1 01-05-2004 02:13 PM



Advertisments