> Would it be possible to add an equivalent to
> lwp_kill() that specifically targets a thread? 

Hmm... after poking around in the code a bit, it's not clear that this would be 
easy to implement (some details below). However, it looks much easier to change 
raise() to accept a second, optional argument. The updated wiki entry might 
read like this:

==========================
void raise(int sig, int directed)
void raise(int sig)

The /raise/ action sends the specified signal to the currently running process, 
or, if /directed/ is non-zero, to the currently running thread. 
==========================

Given that there's no real way for probes on different threads to coordinate, a 
directed raise() probably covers most potential uses for lwp_kill() anyway.

Thoughts?
Ryan

Details on why implementing lwp_kill() might be hard:

With raise() dtrace just marks the thread and lets regular signal handling pick 
it up "soon"; to target a specific other thread would require finding that 
thread and marking it, which in turn would require acquiring the process lock 
(which dtrace doesn't normally touch) and performing several other actions that 
raise() defers to the regular signal handling code. Whether this deferral is 
due to some constraint or whether it was just easier to code up and maintain 
that way, I wouldn't know.

Alternatively, dtrace could just store the request for later, but then it can't 
tell the user if the target lwp exists or not. Plus, a thread could accumulate 
any number of pending lwp kills before they get processed.
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to