Re: Threading and Synchronization in Mass storage driver
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Nov 30, 2005, at 8:53 AM, Herb Petschauer wrote: Hmm, I barely remember this thread (keeping the original subject and quoting the original thread would have been great) but... So: typedef void (*IOThreadFunc)(void *argument); IOThread IOCreateThread(IOThreadFunc function, void *argument); What's your definition of handle_request_loop? static (I hope) void * handle_request_loop( void *arg); rather than static void handle_request_loop( void *arg); which it needs to be to conform to IOThreadFunc. In no way should you have to cast to an IOThreadFunc, this screams ERROR (as does the panic on driver load)... virtual void handle_request_loop(void); = Mike Does this help? Cheers, H. Hi Herb, As per you suggetions, I had tried using following thread call, IOCreateThread(com_My_driver::handle_request_loop, (void*) &thr_id[i]); But I am getting following error during compilation of my driver. When I tried out the following call, I am not getting the compilation error but my driver gets crash as soon as it calls IOCreateThread function. IOCreateThread((IOThreadFunc)&com_My_driver::handle_request_loop, (void*) &thr_id[i]); Please suggest to solve this problem. Thanks in advance, Yogesh Pahilwan This email sent to bogvardi@gmail.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/drivers%40mu.org This email sent to drivers@mu.org _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a...
From the compile error it looks like you are defining it (within your class) as
Actually, you don't need a static method. You can take advantage of the fact that the first (invisible) argument to a member function is 'this' and use something like IOCreateThread(OSMemberFunctionCast(IOThreadFunc, this, &com_My_driver::handle_request_loop), this); However, Yogesh, I'm still very suspicious of your architecture. I haven't seen anything you've said to date that suggests you actually need a set of free-running threads; everything you've described so far can be handled asynchronously. On 30 Nov 2005 11:02:34 +0530, Yogesh P <pahilwan.yogesh@spsoftindia.com> wrote: error: no matches converting function 'handle_request_loop' to type 'void (*) (void*)' error: candidates are: void* com_My_driver::handle_request_loop (void*) _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/bogvardi% 40gmail.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Mike Smith