Example #1
0
void usr2_handler(int sig, siginfo_t *info, void *ctx)
{
    sigset_t sset;
    ucontext_t *context = (ucontext_t*)ctx;
    if ((remote_sig > 0 && waiting_for < 0) || waiting_for == ti_tid) {
        int realsig = remote_sig;
#ifdef __APPLE__
        signal_context = (unw_context_t*)&context->uc_mcontext->__ss;
#else
        signal_context = (unw_context_t*)context;
#endif

        pthread_mutex_lock(&in_signal_lock);
        wait_barrier();
        pthread_cond_wait(&exit_signal_cond, &in_signal_lock);
        wait_barrier();
        pthread_mutex_unlock(&in_signal_lock);

        if (ti_tid == 0 && realsig == SIGINT) {
            if (jl_defer_signal) {
                jl_signal_pending = realsig;
            }
            else {
                jl_signal_pending = 0;
                sigemptyset(&sset);
                sigaddset(&sset, sig);
                sigprocmask(SIG_UNBLOCK, &sset, NULL);
                jl_throw(jl_interrupt_exception);
            }
        }
    }
}
void *spawn_worker(void* params) {
	struct execution_parameters *p = (struct execution_parameters *)params;
	(*p->tsp) = init_execution(p->cluster, p->nb_clusters, p->nb_partitions, p->nb_threads, p->nb_towns, p->seed);
	
	wait_barrier (p->barrier);
	start_execution(*p->tsp);
	wait_barrier (p->barrier);
	end_execution(*p->tsp);

	free(params);
	return NULL;
}
void dlthread_barrier(
    dlthread_comm_t const comm_idx)
{
  if (comm_idx != DLTHREAD_COMM_SINGLE) {
    wait_barrier(&(my_comms[comm_idx].bar),dlthread_get_id(comm_idx));
  }
}
Example #4
0
void *thread_func() {
    printf("Avant barriere.\n");
    wait_barrier(NB_THREADS);
    printf("Après barriere.\n");
    pthread_exit((void *) 0);
    
    return NULL;
}
Example #5
0
File: 3.c Project: psie/Linux
void* pt_funtion(void *t)
{
	printf("%u here, see you in %ds\n", (unsigned)pthread_self(), (int)t);
	sleep((int)t);

	printf("%u is about to hit the barrier\n", (unsigned)pthread_self());
	wait_barrier(&b);

	printf("%u got beyond the barrier, lets repeat\n", (unsigned)pthread_self());

	sleep((int)t);
	
	printf("%u is about to hit the barrier\n", (unsigned)pthread_self());
	wait_barrier(&b);

	printf("%u got beyond the barrier\n", (unsigned)pthread_self());
		
	return;
}
void* thread_func (void *arg) {
   printf ("avant barriere\n");
   wait_barrier (N);
   printf ("après barriere\n");
   pthread_exit ( (void*)0);
}
Example #7
0
void process(int rang) {

	printf("avant barriere fils %d \n", getpid());
	wait_barrier(rang);
	printf("apres barriere fils %d \n", getpid());
}