All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Periodic threads not scheduled anymore during debug session
@ 2009-05-13 12:04 Steven Kauffmann
  2009-05-13 12:59 ` [Xenomai-core] " Philippe Gerum
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Kauffmann @ 2009-05-13 12:04 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

Hi all,

If I connect a debugger to my application, other Xenomai periodic
threads (threads that not belong to the current process I'm debugging
) are not scheduled anymore. Attached you can find a simple example
that reproduces the problem. I run the program 2 times in a different
terminal and connected a debugger to one of them. When a breakpoint is
reached both programs stops their execution but I would expect that
only the program that I'm debugging should stop and not both.

$ cat /proc/xenomai/sched

CPU  PID    PRI      PERIOD     TIMEOUT    TIMEBASE  STAT       NAME
  0  0       -1      0          0          master    R          ROOT
  0  5469     0      1000000001 331274938  master    D
  0  5471     0      1000000001 0          master    XT

This looks normal one thread is stopped ( thread that reaches the
breakpoint ) and the other one is delayed because it's a periodic
thread. Every time I call this command the timeout of the delayed
thread changes so it looks like this thread is still running but in
reality it is not.

I'm using the xenomai 2.4 branch and kernel linux-2.6.28.9 patched
with adeos-ipipe-2.6.28.9-x86-2.2-07.

Regards

Steven

[-- Attachment #2: test_gdb.c --]
[-- Type: text/x-csrc, Size: 1105 bytes --]

#include <sys/mman.h>
#include <native/task.h>
#include <native/timer.h>

RT_TASK task;

void mytask(void* cookie) {

  int ret;

  ret = rt_task_set_periodic(&task, TM_NOW, 1000000000);
  if(ret != 0) {
    printf("Error: rt_task_set_period returned %d\n", ret);
    rt_task_delete(&task);
    return;
  }

  int counter = 0;

  while(1) {
    printf("Counter: %d\n", counter);
    counter++;
    rt_task_wait_period(NULL);
  }

}

int main() {

  int ret;

  mlockall(MCL_CURRENT|MCL_FUTURE);

  ret = rt_task_create(&task, NULL, 0, 0, 0);
  if(ret != 0) {
    printf("Error: rt_task_create returned %d\n", ret);
    return -1;
  }

  ret = rt_task_start(&task, &mytask, NULL);
  if(ret != 0) {
    printf("Error: rt_task_start returned %d\n", ret);
    return -1;
  }

  ret = rt_task_set_periodic(&task, TM_NOW, 1000000000);
  if(ret != 0) {
    printf("Error: rt_task_set_period returned %d\n", ret);
    rt_task_delete(&task);
    return -1;
  }

  getchar();

  ret = rt_task_delete(&task);
  if(ret != 0) {
    printf("Error: rt_task_delete returned %d\n", ret);
    return -1;
  }

  return 0;
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-30 15:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 12:04 [Xenomai-help] Periodic threads not scheduled anymore during debug session Steven Kauffmann
2009-05-13 12:59 ` [Xenomai-core] " Philippe Gerum
2009-05-13 13:16   ` Gilles Chanteperdrix
2009-05-13 13:30     ` Philippe Gerum
2009-05-13 13:34       ` Gilles Chanteperdrix
2009-05-13 13:42         ` Philippe Gerum
2009-05-27  9:23           ` thomas.debes
2009-05-30 15:32             ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.