Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18657
Modified Files: Tag: desiredata d_soundfile.c Log Message: centralise _POSIX_MEMLOCK
Index: d_soundfile.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v retrieving revision 1.4.4.11.2.10.2.17 retrieving revision 1.4.4.11.2.10.2.18 diff -C2 -d -r1.4.4.11.2.10.2.17 -r1.4.4.11.2.10.2.18 *** d_soundfile.c 19 Jul 2007 02:43:33 -0000 1.4.4.11.2.10.2.17 --- d_soundfile.c 19 Jul 2007 02:51:14 -0000 1.4.4.11.2.10.2.18 *************** *** 637,640 **** --- 637,643 ---- #if (_POSIX_MEMLOCK - 0) >= 200112L #include <sys/mman.h> + #else + #define munlockall() /* ignore */ + #define mlockall() /* ignore */ #endif /* _POSIX_MEMLOCK */
*************** *** 882,888 **** post("channels: %d", channels); } ! #if (_POSIX_MEMLOCK - 0) >= 200112L ! munlockall(); ! #endif /* allocate memory for new array */ if (resize) --- 885,889 ---- post("channels: %d", channels); } ! munlockall(); /* allocate memory for new array */ if (resize) *************** *** 953,965 **** post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>."); done: ! if (fd >= 0) ! close (fd); ! #if (_POSIX_MEMLOCK - 0) >= 200112L ! mlockall(MCL_FUTURE); ! #endif ! outargs = (t_int*)getbytes(2*sizeof(t_int)); ! outargs[0] = (t_int)x->outlet; ! outargs[1] = (t_int)itemsread; ! sys_callback(&soundfiler_read_output, outargs, 2); }
--- 954,963 ---- post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>."); done: ! if (fd>=0) close(fd); ! mlockall(MCL_FUTURE); ! outargs = (t_int*)getbytes(2*sizeof(t_int)); ! outargs[0] = (t_int)x->outlet; ! outargs[1] = (t_int)itemsread; ! sys_callback(&soundfiler_read_output, outargs, 2); }
*************** *** 1111,1118 **** if (n < 1) n = 1; elemsize = template_findbyname(x->array.a_templatesym)->t_n * sizeof(t_word); ! ! #if (_POSIX_MEMLOCK - 0) >= 200112L ! munlockall(); ! #endif if (was > n) { nvec = (char*)copyalignedbytes(x->array.a_vec, was * elemsize); --- 1109,1113 ---- if (n < 1) n = 1; elemsize = template_findbyname(x->array.a_templatesym)->t_n * sizeof(t_word); ! munlockall(); if (was > n) { nvec = (char*)copyalignedbytes(x->array.a_vec, was * elemsize); *************** *** 1124,1130 **** if (!nvec) { pd_error(x, "array resize failed: out of memory"); - #if (_POSIX_MEMLOCK - 0) >= 200112L mlockall(MCL_FUTURE); - #endif return; } --- 1119,1123 ---- *************** *** 1143,1149 **** } else garray_redraw(x); freealignedbytes (vec, was * elemsize); ! #if (_POSIX_MEMLOCK - 0) >= 200112L ! mlockall(MCL_FUTURE); ! #endif sys_lock(); outlet_float(y->outlet, (float)atom_getintarg(1,argc,argv)); --- 1136,1140 ---- } else garray_redraw(x); freealignedbytes (vec, was * elemsize); ! mlockall(MCL_FUTURE); sys_lock(); outlet_float(y->outlet, (float)atom_getintarg(1,argc,argv)); *************** *** 1179,1191 **** elemsize = template_findbyname(x->array.a_templatesym)->t_n * sizeof(t_word); /* allocating memory */ - #if (_POSIX_MEMLOCK - 0) >= 200112L munlockall(); - #endif nvec = (char *)getalignedbytes(size * elemsize); if (!nvec) { pd_error(x, "array resize failed: out of memory"); - #if (_POSIX_MEMLOCK - 0) >= 200112L mlockall(MCL_FUTURE); - #endif return; } --- 1170,1178 ---- *************** *** 1204,1210 **** } else garray_redraw(x); freealignedbytes (vec, size * elemsize); - #if (_POSIX_MEMLOCK - 0) >= 200112L mlockall(MCL_FUTURE); - #endif sys_lock(); outlet_float(y->outlet, size); --- 1191,1195 ----