diff --git a/Chapter03/shared-workqueue.c b/Chapter03/shared-workqueue.c index 3eb3749..630d6a5 100644 --- a/Chapter03/shared-workqueue.c +++ b/Chapter03/shared-workqueue.c @@ -22,8 +22,8 @@ static void work_handler(struct work_struct *work) struct work_data, my_work); pr_info("Work queue module handler: %s, data is %d\n", __FUNCTION__, my_data->the_data); msleep(3000); + sleep = 1; wake_up_interruptible(&my_data->my_wq); - kfree(my_data); } static int __init my_init(void) @@ -40,6 +40,7 @@ static int __init my_init(void) pr_info("I'm goint to sleep ...\n"); wait_event_interruptible(my_data->my_wq, sleep != 0); pr_info("I am Waked up...\n"); + kfree(my_data); return 0; } diff --git a/Chapter03/user-invoke.c b/Chapter03/user-invoke.c index 6599a3f..fd09ae3 100644 --- a/Chapter03/user-invoke.c +++ b/Chapter03/user-invoke.c @@ -20,7 +20,7 @@ static void delayed_shutdown(struct work_struct *work) NULL, }; - call_usermodehelper(cmd, argv, envp, 0); + call_usermodehelper(cmd, argv, envp, UMH_WAIT_PROC); } static int __init my_shutdown_init( void )