Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Mar 2006
Testing linux 2.6.5 kernel workqueue
I write a small linux module on Suse server Interprise 9.0 to test out linux workqueue which is shown below. The function MyThread gets called but the data passed to it is wrong. Do you have any idea why? Any help is greatly appreciated. Thank you in advance.
void MyThread(void *data);
static int datapassed;
static struct work_struct *ncbWorkStruct;
static int __init TestNcb_init(void)
datapassed = 0x99;
ncbWorkStruct = kmalloc(sizeof(struct work_struct), GFP_ATOMIC);
INIT_WORK(ncbWorkStruct, MyThread, &datapassed);
printk(KERN_ALERT "End Init\n");
static void __exit TestNcb_exit(void)
printk(KERN_ALERT "End Exit\n");
void MyThread(void *data)
int local = (int)*((int *)data);
/* local is supposed to be 0x99 but it is fd968000 which is wrong */
printk("&&& DataPassed is %x\n", local);
printk("&&& Data is %x\n", datapassed);
- Join Date
- Dec 2004
- Barrie, Ontario
Please refrain from posting the same post multiple times.
To reply to this thread, please use the other copy in the Linux Kernel section.