Permalink
Browse files

Forgotten files

  • Loading branch information...
kmatheussen committed May 30, 2017
1 parent c2281ff commit 687625963872fb52397da28eaa0a5b98d369b003
Showing with 33 additions and 0 deletions.
  1. +6 −0 jack_capture.h
  2. +27 −0 sema.h
View
@@ -0,0 +1,6 @@
#ifndef _JACK_CAPTURE_JACK_CAPTURE_H
#define _JACK_CAPTURE_JACK_CAPTURE_H
void print_message(const char *fmt, ...);
#endif
View
27 sema.h
@@ -0,0 +1,27 @@
#ifndef _JACK_CAPTURE_SEMA_H
#define _JACK_CAPTURE_SEMA_H
#include <errno.h>
#ifdef __APPLE__
#include <mach/mach.h>
#include <sys/sysinfo.h>
#else
#include <semaphore.h>
#endif
#include "jack_capture.h"
#ifdef __APPLE__
#define SEM_TYPE_T semaphore_t
#define SEM_INIT(Sem) semaphore_create(mach_task_self(), &Sem, SYNC_POLICY_FIFO, 0)
#define SEM_SIGNAL(Sem) semaphore_signal(Sem)
#define SEM_WAIT(Sem) {kern_return_t ret;while((ret=semaphore_wait(Sem))!=KERN_SUCCESS) print_message("Warning: semaphore_wait failed: %d",ret);}
#else
#define SEM_TYPE_T sem_t
#define SEM_INIT(Sem) sem_init(&Sem,0,0)
#define SEM_SIGNAL(Sem) sem_post(&Sem)
#define SEM_WAIT(Sem) while(sem_wait(&Sem)==-1) print_message("Warning: sem_wait failed: %s",strerror(errno));
#endif
#endif

0 comments on commit 6876259

Please sign in to comment.