Sorry, it is not pthread_t being defined as "int"; it is SANE_Pid (in sanei_thread.h)
________________________________ From: sane-devel-bounces+glen.petrie=eitc.epson.com at lists.alioth.debian.org [mailto:sane-devel-bounces+glen.petrie=eitc.epson.com at lists.alioth.debia n.org] On Behalf Of Petrie, Glen Sent: Monday, October 08, 2012 2:56 PM To: sane-devel at lists.alioth.debian.org Subject: [sane-devel] Concerns with pthread in SANE 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/0d48eafe/attachment.html>
