I write kernel module with kernel threads using
linux/kthread.h on 2.6.* kernel
I tried to passing data between two kernel threads
with data argument of kthread_run( fun, data , NAME );
but this is not work I dont know why. I tried many possibility
and nothing works.
So I thought that maybe something like this will work
but not.
typedef struct my {
struct socket *tmp;
struct task_struct *task;
int (*fun)(void * );
} table[10];
/* this is global static table */
int kthread_fun1(void *d) {
sock_create( ...., &(tab[0].tmp) )
printk(" %p ", tab[0].tmp ) <- THIS IS NOT NULL OK
}
int ktrhead_fun2( void *d ) {
tab[0].tmp <- THIS IS NULL IN THIS CASE WHY
}
init_function_of_module {
kthread_run( ..., fun1, ... )
kthread_run( ..., fun2, ... )
}
Iam sure that fun1 thread was executed before fun2, I used semaphores ( actually completion mechanism ).