Re: Is thread support available under Linux 2.2.14?

From: Bob Carragher (bobthedancer_at_yahoo.com)
Date: Sat Jan 05 2002 - 11:28:56 GMT


russ_at_amc.com (Russell Browne) writes:
> I've been hacking in support for libthread_db over the last year, with a 
> result that works pretty well on solaris.  I ran into the signal 32
> problem on Linux and went back to work on solaris.
> 
> Bob's mail prompted me to look into this again.
> 
> My Linux system has signal 32 as __SIGRTMIN, while the code in obj_signal.c
> expects this macro to be _SIGRTMIN.  Adding the following at about line
> 133 of  obj_signal.c, just before the use of _SIGRTMIN, should give
> control over the handling of signal 32:
> 
>    #if defined(__SIGRTMIN) && !defined(_SIGRTMIN)
>    #define _SIGRTMIN __SIGRTMIN
>    #endif
>    #if defined(__SIGRTMAX) && !defined(_SIGRTMAX)
>    #define _SIGRTMAX __SIGRTMAX
>    #endif

I added this in and rebuilt ups.  As was probably expected, a
bunch of new signals suddenly became "available" for control
under the debugger.  I modified the action for SIGRT0 (#32) so
that ups would just ignore it.  Although ups no longer halted
on signal 32, it would not let me stop at a breakpoint in the
thread's start function.  Actually, it appeared that ups was
just hanging.  I also tried modifying the action so that ups
would "accept and continue."  Same result.

Note that this was the behavior for a modified version of the
code that I previously posted.  I wanted to try to stop in
the start function, called by the thread creation function.
But the execution would terminate soon after thread creation,
and presumably before ups would detect a stop at any breakpoint
in the start function.  So I "joined" the threads together
using a call to pthread_join() immediately after the call to
pthread_create(), forcing the creating thread to wait for the
created thread to terminate.  I still could not stop at any
breakpoint in the start function.

Curiously, if I disabled the breakpoint (or didn't define one),
then ups would run the program to completion, producing the
same visible behavior as if I had not run it under a debugger.
Perhaps this is to be expected.

Testing some other possibilities, I modified the code to
recursively create and join threads (up to a limit of 10) inside
the start function called by pthread_create().  I set up a global
Boolean variable to toggle whether to do this recursion or not.
I then placed a breakpoint within the code which is executed
depending upon the Boolean variable's value.  If the code is not
executed, then ups will run properly to completion.  If the code
is executed, then ups will hang.  You can "stop" execution by
clicking on the Stop button a couple of times, and ups will
indicate that it is stopped at the pthread_join() function in
main().

I have again appended a uuencoded gzip-ed tar archive for people
to inspect and test with.  The two cases (single-thread-creation
versus multiple-creation using recursive calls to pthread_create())
can be toggled between by changing the value of global Boolean
variable, DoRecursiveThreadCreation, in a.cpp.  (See the README
file contained in the archive.)

				Bob

------------------------------Cut Here------------------------------
begin 600 tosend.tar.gz
M'XL("/3B-CP"`W1O<V5N9"YT87(`[5KK4^,X$N<K^BNZLE-;82<)=IP'8]BK
M`R8,J>.1"V%G[J:F4HHM$B^.Y;5L0FIK__=MR78>NPP.LP74W>KW@<A2J]7J
MA]QM(5C@>M'NUG/",!I&VS#PUS#:K<;:;X8MH]TPF\V6:;6P;9H-J[$%S:T7
M0")B&@%LN31PV(B/OD;WR-#_,D1J?UISPO#9[&\:1NOK]J\W6JW<_D;3-)&^
M;N$P&-K^SX[OO,#Q$Y?!01A/(D;=VN0?9-GI<1%C[U3V$M14[#G@!3&X#,GA
M1S#V\]X1YSZ\YWWF))'P[MA`<3O&/[''`R2]H;Y@^X3<<<^%'ZY0Z_%)$CCE
M]#D\C,8[\"L!A,.3&`X.H'3*?)_#C$>^"S1?M"2'TB8VT'W]?34KDW\80\!F
MZ>KI@)0W8G$2!4.'XZ9^A.I>J]VTC'?+<<$<'KB+<:O=;F6#-U#^ZJYR_at_7-"
M)=7;MW``IK$Z)K$N02ZL(SFQ\O<+D2MKDQ[%Q?79V1/(OU^H_(EK[.ROT:^K
M*M_(S]P+RLM=_&'>;V3Y=V'=$R_PQ(2YL!!LQ<C+)7-KK_648.8A6:I44+*L
M3UE1]_K$2K:!AR:M;&VM?^ED*=MRMKW?")'.,Z6X=]F_at_T=BI@#/!`^4';-]]
M_I)[P1.<\Z^ZQA/<XLDNL6+6/T?-XZZP;OL/G+NC.0,G2IB?1;BR:,H#TLU_
M_at_WV7IEJL!;5:;<WH,RJ>9/A5RQO*[/]W[_]S>LMN/)^]QOO?J!MM]?YOM*U&
MO8VY@&F9AJG?_R^!SJ?.\?#B\+R#`<SN\347TY'/"(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