Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds
H3D.org Forum Index
   Programming Issues
     Thread priorities
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
drmdss
Posted on: 2012/7/27 14:07
Just popping in
Joined: 2012/7/27
From:
Posts: 1
Thread priorities
Hi,

I'm having trouble with thread priorities / scheduling. I have an external DLL library which opens a TCP connection to a robot and then starts a thread that listens for state messages from the robot. The robot sends these messages at 125Hz. The robot is visualized using a custom H3D node which is updated in traverseSG(...) according to the state information received from the robot.

If the robot node is added to the scene on its own, everything works fine - the simulated robot moves smoothly. However, if I add shapes with haptic surfaces to the scene, after a few moments the simulation starts to lag behind and pretty soon completely stops. Although the listener thread is started with the maximum possible priority, it apparently starves because of the high priority of the Phantom haptic device threads.

Is it possible to assign my thread a priority similar to those of the Phantom threads? Or is there some other way to get the thread to be scheduled more often?

Thanks,
Yannick
karlu
Posted on: 2012/8/14 20:15
Guru
Joined: 2004/12/2
From: Sweden
Posts: 765
Re: Thread priorities
To me, this does not sound like a priority problem, more like a synchronization problem. Make sure that your threads do not wait unnecessarily or have some race condition.

Edit: do you flush the TCP buffer? With the robot sending faster than the correct graphics rate (~60 hz) the TCP buffer will fill up quickly. You should check if your graphics thread is running to fast when out of work. Activate vsync for your graphics.


----------------
KJ Lundin Palmerius
C Research
Linköping University, Sweden

Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 



(C) 2012 SenseGraphics AB    ---    Powered by XOOPS