|
a/libupnpp/control/discovery.cxx |
|
b/libupnpp/control/discovery.cxx |
|
... |
|
... |
19 |
#include "discovery.hxx"
|
19 |
#include "discovery.hxx"
|
20 |
|
20 |
|
21 |
#include <pthread.h> // for pthread_cond_broadcast, etc
|
21 |
#include <pthread.h> // for pthread_cond_broadcast, etc
|
22 |
#include <sched.h> // for sched_yield
|
22 |
#include <sched.h> // for sched_yield
|
23 |
#include <stdlib.h> // for free
|
23 |
#include <stdlib.h> // for free
|
24 |
#include <sys/time.h> // for CLOCK_REALTIME
|
24 |
#include <time.h> // for CLOCK_REALTIME
|
|
|
25 |
#include <sys/time.h>
|
|
|
26 |
#include <stdio.h>
|
|
|
27 |
|
|
|
28 |
#ifdef __MACH__
|
|
|
29 |
#include <mach/clock.h>
|
|
|
30 |
#include <mach/mach.h>
|
|
|
31 |
#endif
|
|
|
32 |
|
25 |
#include <unistd.h> // for sleep
|
33 |
#include <unistd.h> // for sleep
|
26 |
#include <upnp/upnp.h> // for Upnp_Discovery, etc
|
34 |
#include <upnp/upnp.h> // for Upnp_Discovery, etc
|
27 |
|
35 |
|
28 |
#include <functional> // for _Bind, bind, function, _1, etc
|
36 |
#include <functional> // for _Bind, bind, function, _1, etc
|
29 |
#include <iostream> // for operator<<, basic_ostream, etc
|
37 |
#include <iostream> // for operator<<, basic_ostream, etc
|
|
... |
|
... |
428 |
// Has locking, do it before our own lock
|
436 |
// Has locking, do it before our own lock
|
429 |
expireDevices();
|
437 |
expireDevices();
|
430 |
|
438 |
|
431 |
struct timespec wkuptime;
|
439 |
struct timespec wkuptime;
|
432 |
long long nanos = getRemainingDelay() * 1000*1000*1000;
|
440 |
long long nanos = getRemainingDelay() * 1000*1000*1000;
|
|
|
441 |
|
|
|
442 |
#ifdef __MACH__ // Mac OS X does not have clock_gettime, use clock_get_time
|
|
|
443 |
clock_serv_t cclock;
|
|
|
444 |
mach_timespec_t mts;
|
|
|
445 |
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
|
|
446 |
clock_get_time(cclock, &mts);
|
|
|
447 |
mach_port_deallocate(mach_task_self(), cclock);
|
|
|
448 |
wkuptime.tv_sec = mts.tv_sec;
|
|
|
449 |
wkuptime.tv_nsec = mts.tv_nsec;
|
|
|
450 |
#else
|
433 |
clock_gettime(CLOCK_REALTIME, &wkuptime);
|
451 |
clock_gettime(CLOCK_REALTIME, &wkuptime);
|
|
|
452 |
#endif
|
|
|
453 |
|
434 |
UPnPP::timespec_addnanos(&wkuptime, nanos);
|
454 |
UPnPP::timespec_addnanos(&wkuptime, nanos);
|
435 |
do {
|
455 |
do {
|
436 |
PTMutexLocker lock(devWaitLock);
|
456 |
PTMutexLocker lock(devWaitLock);
|
437 |
{
|
457 |
{
|
438 |
PTMutexLocker lock(o_pool.m_mutex);
|
458 |
PTMutexLocker lock(o_pool.m_mutex);
|