FreeBSD Bugzilla – Attachment 138082 Details for
Bug 183926
Crash when ctrl-c while process is enter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.txt
file.txt (text/plain), 826 bytes, created by
howard0su
on 2013-11-13 13:30:00 UTC
(
hide
)
Description:
file.txt
Filename:
MIME Type:
Creator:
howard0su
Created:
2013-11-13 13:30:00 UTC
Size:
826 bytes
patch
obsolete
>#include <stdio.h> >#include <pthread.h> >#include <signal.h> > >pthread_cond_t cv; >pthread_mutex_t lock; >pthread_condattr_t ca; >pthread_mutexattr_t ma; > >int done = 0; > >void _sleep() >{ > struct timespec tv; > > clock_gettime(CLOCK_REALTIME,&tv); > tv.tv_sec += 1; > tv.tv_nsec = 0; > > (void) pthread_mutex_lock(&lock); > (void) pthread_cond_timedwait(&cv, &lock, &tv); > (void) pthread_mutex_unlock(&lock); >} > >static void >intr(int signo) >{ > done++; >} > > >int main() >{ > struct sigaction act; > > pthread_condattr_init(&ca); > pthread_mutexattr_init(&ma); > pthread_mutex_init(&lock, &ma); > pthread_cond_init(&cv, &ca); > > > (void) sigemptyset(&act.sa_mask); > act.sa_flags = 0; > act.sa_handler = intr; > > (void) sigaction(SIGINT, &act, NULL); > > while(!done) > { > printf("enter\n"); > _sleep(); > printf("exit\n"); > } > > printf("done\n"); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 183926
: 138082