[PD-cvs] externals/tb/sndfiler/src sndfiler.c,1.5,1.6

Thomas Grill xovo at users.sourceforge.net
Thu Jan 19 22:02:15 CET 2006


Update of /cvsroot/pure-data/externals/tb/sndfiler/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21195/src

Modified Files:
	sndfiler.c 
Log Message:
fixes for OSX (doesn't have a sem_init function)

Index: sndfiler.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/sndfiler/src/sndfiler.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** sndfiler.c	22 Dec 2005 23:45:20 -0000	1.5
--- sndfiler.c	19 Jan 2006 21:02:12 -0000	1.6
***************
*** 130,134 ****
  {
      t_fifo* x_jobs;
!     sem_t sem;
  } t_sfqueue;
  
--- 130,134 ----
  {
      t_fifo* x_jobs;
!     sem_t* sem;
  } t_sfqueue;
  
***************
*** 155,163 ****
  static void sndfiler_thread(void)
  {
!     while (1)
      {
          t_sfprocess * me;
!         sem_wait(&sndfiler_queue.sem);
!         
          while (me = (t_sfprocess *)fifo_get(sndfiler_queue.x_jobs))
          {
--- 155,163 ----
  static void sndfiler_thread(void)
  {
!     for(;;)
      {
          t_sfprocess * me;
!         sem_wait(sndfiler_queue.sem);
! 
          while (me = (t_sfprocess *)fifo_get(sndfiler_queue.x_jobs))
          {
***************
*** 179,184 ****
      //initialize queue
      sndfiler_queue.x_jobs = fifo_init();
!     sem_init (&sndfiler_queue.sem,0,0);
!     
      // initialize thread
      pthread_attr_init(&sf_attr);
--- 179,193 ----
      //initialize queue
      sndfiler_queue.x_jobs = fifo_init();
! #ifdef __APPLE__
! 	sndfiler_queue.sem = sem_open("sndfilerthread",O_CREAT|O_EXCL,0,0);
!     if(sndfiler_queue.sem == SEM_FAILED)
!         error("Couldn't create sndfiler semaphore: %i",errno);
! #else
! 	sndfiler_queue.sem = (sem_t *)getbytes(sizeof(sem_t));
! 	status = sem_init(sndfiler_queue.sem,0,0);
!     if(status != 0)
!         error("Couldn't create sndfiler semaphore: %i",status);
! #endif
! 	
      // initialize thread
      pthread_attr_init(&sf_attr);
***************
*** 225,229 ****
      fifo_put(sndfiler_queue.x_jobs, process);
  
!     sem_post(&sndfiler_queue.sem);
  }
  
--- 234,238 ----
      fifo_put(sndfiler_queue.x_jobs, process);
  
!     sem_post(sndfiler_queue.sem);
  }
  
***************
*** 460,464 ****
      fifo_put(sndfiler_queue.x_jobs, process);
  
!     sem_post(&sndfiler_queue.sem);
  }
  
--- 469,473 ----
      fifo_put(sndfiler_queue.x_jobs, process);
  
!     sem_post(sndfiler_queue.sem);
  }
  





More information about the Pd-cvs mailing list