Improve loop callbacks

Pass just one data item to the callbacks.
Add properties to port.
Add user data to link
Handle autolink with multiple ports
More work on jack support
This commit is contained in:
Wim Taymans 2017-08-11 19:16:30 +02:00
parent cfd9967637
commit 9ad1f911b2
38 changed files with 1773 additions and 271 deletions

View file

@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#include <semaphore.h>
struct jack_synchro {
char name[SYNC_MAX_NAME_SIZE];
bool flush;
@ -46,3 +48,29 @@ jack_synchro_init(struct jack_synchro *synchro,
}
return 0;
}
static inline bool
jack_synchro_signal(struct jack_synchro *synchro)
{
int res;
if (synchro->flush)
return true;
if ((res = sem_post(synchro->semaphore)) < 0)
pw_log_error("semaphore %s post err = %s", synchro->name, strerror(errno));
return res == 0;
}
static inline bool
jack_synchro_wait(struct jack_synchro *synchro)
{
int res;
while ((res = sem_wait(synchro->semaphore)) < 0) {
if (errno != EINTR)
continue;
pw_log_error("semaphore %s wait err = %s", synchro->name, strerror(errno));
break;
}
return res == 0;
}