Re: Threading and Synchronization in Mass storage driver
Re: Threading and Synchronization in Mass storage driver
- Subject: Re: Threading and Synchronization in Mass storage driver
- From: Mike Smith <email@hidden>
- Date: Wed, 30 Nov 2005 09:27:16 -0800
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?
From the compile error it looks like you are defining it (within
your class) as
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)...
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
virtual void handle_request_loop(void);
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.
= Mike
Does this help?
Cheers,
H.
On 30 Nov 2005 11:02:34 +0530, Yogesh P
<email@hidden> wrote:
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.
error: no matches converting function 'handle_request_loop' to type
'void (*) (void*)'
error: candidates are: void* com_My_driver::handle_request_loop
(void*)
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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden