Re: [PATCH BlueZ 1/2] Add support for cancelling a LE Scan with Control-C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johan,

On 18:49 Thu 06 Oct, Johan Hedberg wrote:
> Hi Vinicius,
> 
> On Thu, Oct 06, 2011, Vinicius Costa Gomes wrote:
> > ---
> > +static void sigint_handler(int sig)
> > +{
> > +	int err;
> > +
> > +	setsockopt(signal_data.fd, SOL_HCI, HCI_FILTER, &signal_data.of, sizeof(signal_data.of));
> > +
> > +	err = hci_le_set_scan_enable(signal_data.fd, 0x00, 0x00, 1000);
> > +	if (err < 0) {
> > +		perror("Disable scan failed");
> > +		exit(1);
> > +	}
> > +
> > +	hci_close_dev(signal_data.fd);
> > +
> > +	exit(0);
> > +}
> 
> To my understanding the general recommendation is to do as little as
> possible within signal handlers. Would it therefore make more sense to
> simply set a flag (indicating which signal was received) in the handler,
> and then do the necessary cleanup within the original function by
> handling EINTR there (presumably returned by the read system call)?

Yes, makes sense. Will fix.

> 
> Johan


Cheers,
-- 
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux