changing the ucontext structure in a sigaction handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all ,

I am trying to build a simple pre-emptive userspace thread library using makecontext,getcontext and swapcontext.

Is it safe to assign the ucontext_t struct passed in a sighandler with a ucontext_t struct created using getcontext ?

I am currently using Redhat Linux 7.3 with gcc 2.96 .

If anybody has any idea regarding what can be the potential problem with 
such usage ? 

Regards
Kshitiz

eg. 

static void handler_sigalrm(int sig ,siginfo_t  *sip ,void *arg) {
  ucontext_t * uap = (ucontext_t *)arg;
  int x;
  current_thread = *uap; // current_thread and other_thread are global
  *uap = other_thread;   // object of type ucontext_t
}


_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux