Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
How to make a function call asynchronous
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to make a function call asynchronous



Hi all,
I have written a scsi pass through driver on Mac Os X
. I have used VendorSpecificType00UC driver available
on apple site.
But currently my function calls in the driver are
synchronous due to which I am getting a low
performance. So I want to make that driver
asynchronous i.e. all function call like
read,write,inquiry, read_capacity will work
asynchronously. So I have done some changes as follows
in my existing code.
Changes are
1) Setting Application layers reference in request
using SetApplicationLayerReference (..)
2) Instead of using Send_Command(request , timeout ),
I have used Send_Command(request,timeout,callback) to
give the name of callback function.

In my driver , my user client is calling the
functionality of my driver.

Code snap as follows
class com_MyCompany_driver_VendorSpecificType00UC:
public IOSCSIBlockCommandsDevice
{
void ReadCapacity(....);
static void sTaskCallback(..);
};

void
com_MyCompany_driver_VendorSpecificType00UC::ReadCapacity(....)
{

	refCon = ( SCSITaskRefCon * )
GetApplicationLayerReference ( request);
	refCon->commandType = kCommandTypeExecuteAsync;
	refCon->self		= this;
	SetApplicationLayerReference ( request , (void *)
&refCon );
                               			create_cdb(request);
	SetDataTransferDirection(request,
kSCSIDataTransfer_FromTargetToInitiator);
	SetDataBuffer(request, tempbuf);
	SetRequestedDataTransferCount(request,
DataTransferCount);
	SendCommand(request
20,&com_MyCompany_driver_VendorSpecificType00UC::sTaskCallback);

}

void
com_MyCompany_driver_VendorSpecificType00UC::sTaskCallback(..)
{

.........

}

When my program calls ReadCapacity(..) , my machines
gets crashed.I am not able to trace this
problem.Please give me some hint or direction so that
I will make all function call asynchronous.

Regards,
Girish.
Email Address : email@hidden








__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.