Re: [ros-users] need help: set_parameters service callback v…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] need help: set_parameters service callback very sluggish with nodelet-based camera1394 driver
On Thu, Feb 3, 2011 at 10:37 AM, Blaise Gassend <> wrote:
>>> Is this not the defining use case for pthread yield() ?
>> It preempts and puts the current thread at the end of the run queue,
>> effectively directly going to the waiting thread which acquires the
>> lock. If there is no thread in the run queue, it immediately resumes.
>>
>> http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_yield.3.html
>
> I did not realize that yield actually puts the thread at the bottom of
> the queue for its run level. That being the case, that's definitely
> the way to go here.


It's the most elegant solution, but not cheap.

On an SMP machine, suspending the current thread and checking all the
run queues in case there is something waiting on this lock is an
expensive operation. That's probably why Linux does not do it
automatically when the lock is released.

> Jack, I wouldn't be as concerned as you are about pushing this change
> into diamondback. It is a simplification of the existing code. It
> reverts back to a former state of the code. It does not break the API
> in any way.


I am not much worried about breaking the code. It's more a matter of
having several other urgent problems to work on.
--
 joq