[sane-devel] Concerns with pthread in SANE

Petrie, Glen glen.petrie at eitc.epson.com
Mon Oct 8 21:55:40 UTC 2012


Hello all,

 

As you may know (not know), I am try put the SANE dll into the LSB (the
Linux Standard Base).   In doing so, I need to include the testing tools
and, as such, I trying to get all of SANE to compile and execute
correctly using the LSB's compiler (lsbcc).  With the changes (only a
few) I have made, I can compile and link SANE under the LSB with the
exception of using pthreads.  There are a couple of warnings to note:

 

1.      The variable type pthread_t (for linux) is defined as "int" and
test are done against negative values (specifically, -1) of this type.

a.       While, in general, pthread_t is supposed to be opaque entity
(object); it is typically defined as "unsigned long int" which produce
many warning of unsigned and signed comparison.

 
i.      From the web the recommendations for 

1.      defining an invalid pthread (versus using "-1") is to use "
pthread_t invalid_thread = pthread_self();

2.      setting incorrect pthread_t to "invalid_thread" versus "-1"

3.      and comparison should be done using "if (pthread_equal(pid,
invalid_thread))" versus "if (pid == -1)"

2.      I also found some if statements that use "B_OK" but I could not
find where "B_OK" is defined (either in SANE stuff or /usr/...)

 

 

Based on the above there are too many changes involved in pthread code
and I don't want to introduce errors into SANE; so, I will disable
pthread for the LSB work (useless someone else updates the pthread code
as recommend by the suggestions on the web).

 

Glen 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20121008/4d1da2bb/attachment-0001.html>


More information about the sane-devel mailing list