help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Fwd: Re: Thread local storage: add example


From: Andrew Makhorin
Subject: Re: [Help-glpk] Fwd: Re: Thread local storage: add example
Date: Sat, 14 Jan 2017 17:49:12 +0300

Hi Heinrich,

> it seems you missed the mail below.
> 
> Could you, please, add the appended README.md to tls/examples.

Done.

> I understand that you do not want to create env before checking if TLS
> is configured. But, please, do not call abort() in glp_config().
> 
> Otherwise your abort statement will stop the complete application.
> Imagine that being the webserver for a site on which a webapp is
> deployed which calls the GLPK library.
> 
> Either simply return NULL. Or define a value with signifies an error:
> 
> glpk.h:
> #define GLP_INVALID ((const void *) -1)
> 
> env/env.c:
> const char *glp_config(const char *option)
> {
> ...
>    return GLP_INVALID;
> ...
> }
> 

> I guess the best solution will be to return the empty string "" when
> an
> option is not set and NULL if the option does not exist.
> 
> Then we can use
> 
> const char *ret = get_config("TLS");
> if (!ret || !*ret) {
>         fprintf(stderr, "TLS not supported");
>         pthread_exit(NULL);
> }

I changed glp_config to return NULL for any unknown option as if this
option were disabled.

> if a multithreaded application wants to determine if GLPK supports a
> feature we now supply glp_config which does not initialize env.
> I guess we should do the same for glp_version.
> 
> This makes env smaller and can safely be called even if the library is
> not TLS enabled.
> 
> #define str(s) # s
> #define xstr(s) str(s)
> 
> const char *glp_version(void)
> {     return xstr(GLP_MAJOR_VERSION) "." xstr(GLP_MINOR_VERSION);
> }

Done.

Please see an updated version of glpk here:
http://sourceforge.net/projects/noumenon/files/tmp/
(Note that this is *not* an official release.)


Best regards,

Andrew Makhorin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]