On Saturday 15 September 2007 10:50:50 pm Kurt Miller wrote: > The following are programs I wrote when I isolated the problem. > If the c program runs ok on 7.0 for both single cpu and mp then > remove the os_sleep() and try the java program. If that works too > then you're clear to make the os_sleep() hack only apply to < > 7.0 and still be able to pass the certification tests.
Sorry copy/paste glitch. He is the c program again: #include <pthread.h> #include <unistd.h> #include <signal.h> #include <inttypes.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> volatile int init=0; volatile int interrupt=0; static void * yielder(void *arg) { init = 1; while (1) { pthread_yield(); } } static void sighandler(int sig) { interrupt = 1; printf("sighandler\n"); } static void waitForInit() { struct timespec t, rt; while (init == 0) { t.tv_sec = 0; t.tv_nsec = 100000; nanosleep(&t, &rt); } } static void waitForInterrupt() { struct timespec t, rt; while (interrupt == 0) { t.tv_sec = 0; t.tv_nsec = 100000; nanosleep(&t, &rt); } } int main(int argc, char *argv[]) { pthread_t yldr; pthread_attr_t attr; struct sigaction act; /* Install a signal handler for SIGUSR1 */ sigemptyset (&act.sa_mask); sigaddset (&act.sa_mask, SIGUSR1); act.sa_handler = sighandler; act.sa_flags = 0; sigaction (SIGUSR1, &act, NULL); pthread_attr_init(&attr); pthread_attr_setschedpolicy(&attr, SCHED_FIFO); pthread_create(&yldr, &attr, yielder, NULL); pthread_setprio(yldr, 16); waitForInit(); if(pthread_kill(yldr, SIGUSR1) != 0) printf("pthread_kill failed with errno = %d\n", errno); waitForInterrupt(); } _______________________________________________ freebsd-performance@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-performance To unsubscribe, send any mail to "[EMAIL PROTECTED]"