Just to keep the group updated - I did figure out the answer to this question browsing through the workqueue code in Linux (I completely forgot that I had sent this mail to the group until I stumbled upon it today).
On a uni-processor machine when the workqueue function is already is the queue i.e. scheduled then a second call to schedule will return ZERO / if the workqueue function is not scheduled then the return value will be NON-ZERO. The code in schedule_work() function that does did is --if (!test_and_set_bit(0, &work->pending))-- If the design is to schedule the workqueue function every time irrespective of whether the workqueue function was already scheduled or not one has to design their schedule_work() caller to queue things up else we can ignore the return value of schedule_work(). Regards, Nithish Mahalingam -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mahalingam, Nithish Sent: Monday, August 25, 2008 9:27 PM To: [email protected] Subject: [Moblin Dev] Linux workqueue I have a basic question on Linux workqueues - I know workqueue can run concurrently run on an SMP machine but not on an uni-processor machine. My question is on a uni-processor machine - What will happen when I schedule a workqueue function when an instance of the same is already executing in the kernel? Will the workqueue function I scheduled the second time get queued, so that it gets called once the first instance of it which was executing completes? Or will I lose the second scheduled workqueue because an instance of the same was already running in the kernel? Regards, Nithish Mahalingam _______________________________________________ dev mailing list [email protected] https://www.moblin.org/mailman/listinfo/dev _______________________________________________ dev mailing list [email protected] https://www.moblin.org/mailman/listinfo/dev
