Esempio n. 1
0
static int __init kthread_init(void)
{
    printk("init thread\n");
    printk("Function name is %s\n", __FUNCTION__);


    if(init_thread())
        goto err;

    return 0;

err:
    clean_thread();
    return -1;
}
Esempio n. 2
0
int main()
{
	int		i;
	pthread_barrier_init(&pt_barrier, NULL, NUM_THREADS -1);
	for(i=0; i<NUM_THREADS; i++) {
		t_arg[i].idx = i;
		if (pthread_create(&t_arg[i].tid, NULL, start_thread, (void *)&t_arg[i])) {
			fprintf(stdout, "[MAIN] FAIL: pthread_create()\n");
			return 0;
		}
	}
	clean_thread(t_arg);
	pthread_barrier_destroy(&pt_barrier);
	return 0;
}
Esempio n. 3
0
static int __init kthread_init(void)
{
	printk("init thread\n");
	printk("Function name is %s\n",__FUNCTION__);

#ifndef STATIC_INIT_THREAD
	create_threadlock();
#else 
	printk("static init threadlock\n");
#endif
	
	if(init_thread())
		goto err;

	return 0;
	
err:
	clean_thread();
	return -1;
}
Esempio n. 4
0
int main()
{
	t_arg[0].idx = 0;
	t_arg[0].x = "1";
	t_arg[0].y = "3";
    if (pthread_create(&t_arg[0].tid, NULL, start_func, &t_arg[0]) != 0) {
        exit(1);
    }
	t_arg[1].idx = 1;
	t_arg[1].x = "4";
	t_arg[1].y = "4";
    if (pthread_create(&t_arg[1].tid, NULL, start_func, &t_arg[1]) != 0) {
        exit(1);
    }
	t_arg[2].idx = 2;
	t_arg[2].x = "1";
	t_arg[2].y = "5";
    if (pthread_create(&t_arg[2].tid, NULL, start_func, &t_arg[2]) != 0) {
        exit(1);
    }
	clean_thread(t_arg);
    return EXIT_SUCCESS;
}	
Esempio n. 5
0
static void __exit kthread_exit(void)
{
	printk("exit thread\n");
	printk("Function name is %s\n",__FUNCTION__);
	clean_thread();
}