ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libcoro/coro.c
(Generate patch)

Comparing libcoro/coro.c (file contents):
Revision 1.22 by root, Sat Nov 25 00:27:00 2006 UTC vs.
Revision 1.23 by root, Thu Nov 30 18:21:14 2006 UTC

98# endif 98# endif
99 99
100#endif 100#endif
101 101
102/* initialize a machine state */ 102/* initialize a machine state */
103void coro_create(coro_context *ctx, 103void coro_create (coro_context *ctx,
104 coro_func coro, void *arg, 104 coro_func coro, void *arg,
105 void *sptr, long ssize) 105 void *sptr, long ssize)
106{ 106{
107#if CORO_UCONTEXT 107#if CORO_UCONTEXT
108 108
109 getcontext (&(ctx->uc)); 109 getcontext (&(ctx->uc));
110 110
140 nsa.sa_handler = trampoline; 140 nsa.sa_handler = trampoline;
141 sigemptyset (&nsa.sa_mask); 141 sigemptyset (&nsa.sa_mask);
142 nsa.sa_flags = SA_ONSTACK; 142 nsa.sa_flags = SA_ONSTACK;
143 143
144 if (sigaction (SIGUSR2, &nsa, &osa)) 144 if (sigaction (SIGUSR2, &nsa, &osa))
145 {
145 perror ("sigaction"); 146 perror ("sigaction");
147 abort ();
148 }
146 149
147 /* set the new stack */ 150 /* set the new stack */
148 nstk.ss_sp = STACK_ADJUST_PTR (sptr,ssize); /* yes, some platforms (IRIX) get this wrong. */ 151 nstk.ss_sp = STACK_ADJUST_PTR (sptr,ssize); /* yes, some platforms (IRIX) get this wrong. */
149 nstk.ss_size = STACK_ADJUST_SIZE (sptr,ssize); 152 nstk.ss_size = STACK_ADJUST_SIZE (sptr,ssize);
150 nstk.ss_flags = 0; 153 nstk.ss_flags = 0;
151 154
152 if (sigaltstack (&nstk, &ostk) < 0) 155 if (sigaltstack (&nstk, &ostk) < 0)
156 {
153 perror ("sigaltstack"); 157 perror ("sigaltstack");
158 abort ();
159 }
154 160
155 trampoline_count = 0; 161 trampoline_count = 0;
156 kill (getpid (), SIGUSR2); 162 kill (getpid (), SIGUSR2);
157 sigfillset (&nsig); sigdelset (&nsig, SIGUSR2); 163 sigfillset (&nsig); sigdelset (&nsig, SIGUSR2);
158 164

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines