├── .gitignore ├── lib ├── pthreads-w32 │ ├── pthread-rg.c │ ├── fork.c │ ├── sync.c │ ├── pthread_getconcurrency.c │ ├── exit.c │ ├── cancel.c │ ├── tsd.c │ ├── pthread_getunique_np.c │ ├── pthread_mutexattr_getkind_np.c │ ├── pthread_mutexattr_setkind_np.c │ ├── spin.c │ ├── pthread_setconcurrency.c │ ├── ptw32_is_attr.c │ ├── ptw32_calloc.c │ ├── barrier.c │ ├── misc.c │ ├── pthread_attr_getinheritsched.c │ ├── pthread_attr_setschedpolicy.c │ ├── pthread_num_processors_np.c │ ├── pthread_attr_getschedparam.c │ ├── nonportable.c │ ├── pthread_mutexattr_gettype.c │ ├── condvar.c │ ├── ptw32_rwlock_cancelwrwait.c │ ├── pthread_attr_getscope.c │ ├── pthread_attr_setinheritsched.c │ ├── sem_close.c │ ├── pthread_attr_getschedpolicy.c │ ├── sem_unlink.c │ ├── sched.c │ ├── private.c │ ├── attr.c │ ├── rwlock.c │ ├── sem_open.c │ ├── pthread_attr_setscope.c │ ├── pthread_attr_setschedparam.c │ ├── pthread_getw32threadhandle_np.c │ ├── pthread.c │ ├── sched_getscheduler.c │ ├── pthread_barrier_init.c │ ├── pthread_spin_unlock.c │ ├── mutex.c │ ├── semaphore.c │ ├── context.h │ ├── pthread_spin_trylock.c │ ├── pthread_spin_lock.c │ ├── autostatic.c │ ├── pthread_getschedparam.c │ ├── sched_yield.c │ ├── pthread_attr_destroy.c │ ├── sched_setscheduler.c │ ├── pthread_equal.c │ ├── pthread_once.c │ ├── ptw32_threadDestroy.c │ ├── ptw32_cond_check_need_init.c │ ├── ptw32_rwlock_check_need_init.c │ ├── pthread_rwlockattr_init.c │ ├── dll.c │ ├── ptw32_getprocessors.c │ ├── ptw32_spinlock_check_need_init.c │ ├── pthread_mutexattr_destroy.c │ ├── pthread_barrierattr_destroy.c │ ├── pthread_rwlock_unlock.c │ ├── pthread_rwlockattr_destroy.c │ ├── pthread_barrierattr_init.c │ ├── pthread_condattr_destroy.c │ ├── pthread_mutexattr_init.c │ ├── pthread_getspecific.c │ ├── ptw32_new.c │ ├── errno.c │ └── pthread_condattr_init.c ├── sord │ ├── zix │ │ ├── digest.h │ │ ├── digest.c │ │ └── common.h │ └── sord_internal.h └── lilv │ ├── scalepoint.c │ ├── zix │ └── common.h │ └── pluginclass.c ├── include ├── serd_config.h ├── sord_config.h ├── lilv_config.h └── lv2 │ └── lv2plug.in │ └── ns │ ├── ext │ ├── instance-access │ │ └── instance-access.h │ ├── presets │ │ └── presets.h │ ├── morph │ │ └── morph.h │ ├── buf-size │ │ └── buf-size.h │ ├── time │ │ └── time.h │ ├── port-props │ │ └── port-props.h │ ├── data-access │ │ └── data-access.h │ ├── patch │ │ └── patch.h │ └── resize-port │ │ └── resize-port.h │ └── lv2core │ └── lv2_util.h ├── update_lv2stack.sh ├── src ├── vstmain.cc ├── loadlib.h ├── lv2ttl.h ├── worker.h ├── uri_map.h └── lv2desc.h └── misc └── plist /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | cscope.* 3 | tags 4 | *.so 5 | *.dll 6 | *.dylib 7 | *.dSYM/ 8 | *.o 9 | /lv2.vst/ 10 | /bundles 11 | /whitelist 12 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread-rg.c: -------------------------------------------------------------------------------- 1 | #include "pthread.h" 2 | #include "implement.h" 3 | 4 | #include "private.c" 5 | 6 | #include "cancel.c" 7 | #include "cleanup.c" 8 | #include "condvar.c" 9 | #include "create.c" 10 | #include "autostatic.c" 11 | #include "global.c" 12 | #include "misc.c" 13 | #include "mutex.c" 14 | #include "nonportable.c" 15 | #include "sched.c" 16 | -------------------------------------------------------------------------------- /include/serd_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _SERD_CONFIG_H_ 2 | #define _SERD_CONFIG_H_ 3 | 4 | #define SERD_INTERNAL 5 | 6 | #define HAVE_FILENO 1 7 | #define SERD_VERSION "0.23.0" 8 | 9 | #if defined(__APPLE__) || defined(__WIN32__) 10 | 11 | #elif defined(__HAIKU__) 12 | # define HAVE_POSIX_MEMALIGN 1 13 | #else 14 | # define HAVE_POSIX_MEMALIGN 1 15 | # define HAVE_POSIX_FADVISE 1 16 | #endif 17 | 18 | #endif /* _SERD_CONFIG_H_ */ 19 | -------------------------------------------------------------------------------- /include/sord_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _SORD_CONFIG_H_ 2 | #define _SORD_CONFIG_H_ 3 | 4 | #define SORD_INTERNAL 5 | 6 | #define HAVE_FILENO 1 7 | #define SERD_VERSION "0.23.0" 8 | #define HAVE_SERD 1 9 | #define SORD_VERSION "0.15.1" 10 | 11 | #if defined(__APPLE__) || defined(__WIN32__) 12 | 13 | #elif defined(__HAIKU__) 14 | # define HAVE_POSIX_MEMALIGN 1 15 | #else 16 | # define HAVE_POSIX_MEMALIGN 1 17 | # define HAVE_POSIX_FADVISE 1 18 | #endif 19 | 20 | #endif /* _SORD_CONFIG_H_ */ 21 | -------------------------------------------------------------------------------- /update_lv2stack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DROBILLAD=$HOME/src/drobillad/ 4 | LV2GIT=$HOME/src/lv2/ 5 | 6 | TOP=`pwd` 7 | 8 | test -d $TOP/include || exit 9 | test -d $TOP/lib/lilv || exit 10 | 11 | for lib in lilv serd sord sratom; do 12 | for file in `find lib/$lib -type f`; do 13 | find ${DROBILLAD}${lib} -type f -name `basename $file` -exec cp -v {} $file \; 14 | done 15 | for file in `find include/$lib -type f`; do 16 | find ${DROBILLAD}${lib} -type f -name `basename $file` -exec cp -v {} $file \; 17 | done 18 | done 19 | 20 | exit ## DRY-RUN 21 | 22 | cd $LV2GIT 23 | ./waf configure --prefix=/tmp/lv2stack --no-plugins --copy-headers 24 | ./waf build install 25 | rsync -a --delete /tmp/lv2stack/lib/lv2/ $TOP/include/lv2/ 26 | -------------------------------------------------------------------------------- /src/vstmain.cc: -------------------------------------------------------------------------------- 1 | #include "vst.h" 2 | 3 | extern "C" { 4 | 5 | __attribute__ ((visibility ("default"))) 6 | AEffect* VSTPluginMain (audioMasterCallback audioMaster) 7 | { 8 | if (!audioMaster (0, audioMasterVersion, 0, 0, 0, 0)) 9 | return 0; 10 | 11 | VstPlugin* effect = instantiate_vst (audioMaster); 12 | if (!effect) 13 | return 0; 14 | 15 | return effect->get_effect (); 16 | } 17 | 18 | #if (!defined _WIN32 || defined _WIN64) 19 | /* i686-w64-mingw32-g++ can't export main */ 20 | __attribute__ ((visibility ("default"))) 21 | AEffect* wrap (audioMasterCallback audioMaster) asm ("main"); 22 | 23 | AEffect* wrap (audioMasterCallback audioMaster) 24 | { 25 | return VSTPluginMain (audioMaster); 26 | } 27 | #endif 28 | 29 | } 30 | -------------------------------------------------------------------------------- /misc/plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CFBundleExecutable 7 | @EXEC@ 8 | CFBundleInfoDictionaryVersion 9 | 6.0 10 | CFBundleIconFile 11 | @ICON@ 12 | CFBundleName 13 | LV2-VST Bridge 14 | CFBundleIdentifier 15 | org.gareus.oss.lv2vst 16 | CFBundlePackageType 17 | BNDL 18 | CFBundleVersion 19 | @VERSION@ 20 | CSResourcesFileMapped 21 | 22 | CFBundleSignature 23 | ???? 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/loadlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Robin Gareus 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _loadlib_h_ 20 | #define _loadlib_h_ 21 | 22 | typedef void (*VstVoidFunc)(void); 23 | VstVoidFunc x_dlfunc (void* handle, const char* symbol); 24 | void* open_lv2_lib (const char* lib_path, bool persist = false); 25 | void close_lv2_lib (void*); 26 | 27 | const char* get_lib_path (); 28 | #endif 29 | -------------------------------------------------------------------------------- /src/lv2ttl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Robin Gareus 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _lv2ttl_h_ 20 | #define _lv2ttl_h_ 21 | 22 | #include "lv2desc.h" 23 | 24 | RtkLv2Description* get_desc_by_id (uint32_t id, char const* const* bundle); 25 | RtkLv2Description* get_desc_by_uri (const char* uri, char const* const* bundle); 26 | void free_desc (RtkLv2Description* desc); 27 | uint32_t uri_to_id (const char* plugin_uri); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/lilv_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _LILV_CONFIG_H_ 2 | #define _LILV_CONFIG_H_ 3 | 4 | #define LILV_INTERNAL 5 | 6 | #define HAVE_FILENO 1 7 | #define SERD_VERSION "0.23.0" 8 | #define HAVE_SERD 1 9 | #define SORD_VERSION "0.15.1" 10 | #define HAVE_SORD 1 11 | #define SRATOM_VERSION "0.4.10" 12 | #define HAVE_SRATOM 1 13 | 14 | #define HAVE_CLOCK_GETTIME 1 15 | #define LILV_VERSION "0.22.1" 16 | 17 | #ifdef __WIN32__ 18 | # define LILV_PATH_SEP ";" 19 | # define LILV_DIR_SEP "\\" 20 | #else 21 | # define LILV_PATH_SEP ":" 22 | # define LILV_DIR_SEP "/" 23 | # define HAVE_FLOCK 1 24 | #endif 25 | 26 | #if defined(__APPLE__) 27 | # define LILV_DEFAULT_LV2_PATH "~/.lv2:~/Library/Audio/Plug-Ins/LV2:/Library/Audio/Plug-Ins/LV2" 28 | #elif defined(__HAIKU__) 29 | # define HAVE_POSIX_MEMALIGN 1 30 | # define LILV_DEFAULT_LV2_PATH "~/.lv2:/boot/common/add-ons/lv2" 31 | #elif defined(__WIN32__) 32 | //# define LILV_DEFAULT_LV2_PATH "%APPDATA%\\LV2;%COMMONPROGRAMFILES%\\LV2;%CommonProgramFiles(x86)%\\LV2" 33 | # define LILV_DEFAULT_LV2_PATH "%APPDATA%\\LV2;%COMMONPROGRAMFILES%\\LV2" 34 | #else 35 | # define LILV_DEFAULT_LV2_PATH "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2" 36 | # define HAVE_POSIX_MEMALIGN 1 37 | # define HAVE_POSIX_FADVISE 1 38 | #endif 39 | 40 | #endif /* _LILV_CONFIG_H_ */ 41 | -------------------------------------------------------------------------------- /lib/sord/zix/digest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef ZIX_DIGEST_H 18 | #define ZIX_DIGEST_H 19 | 20 | #include 21 | #include 22 | 23 | #include "zix/common.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | ZIX_API uint32_t 30 | zix_digest_start(void); 31 | 32 | ZIX_API uint32_t 33 | zix_digest_add(uint32_t hash, const void* buf, const size_t len); 34 | 35 | #ifdef __cplusplus 36 | } /* extern "C" */ 37 | #endif 38 | 39 | #endif /* ZIX_DIGEST_H */ 40 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/instance-access/instance-access.h: -------------------------------------------------------------------------------- 1 | /* 2 | LV2 Instance Access Extension 3 | Copyright 2008-2012 David Robillard 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | /** 19 | @defgroup instance-access Instance Access 20 | 21 | Access to the LV2_Handle of a plugin for UIs; see 22 | for details. 23 | 24 | @{ 25 | */ 26 | 27 | #ifndef LV2_INSTANCE_ACCESS_H 28 | #define LV2_INSTANCE_ACCESS_H 29 | 30 | #define LV2_INSTANCE_ACCESS_URI "http://lv2plug.in/ns/ext/instance-access" 31 | 32 | #endif /* LV2_INSTANCE_ACCESS_H */ 33 | 34 | /** 35 | @} 36 | */ 37 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/presets/presets.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup presets Presets 19 | 20 | Presets for plugins, see for details. 21 | 22 | @{ 23 | */ 24 | 25 | #ifndef LV2_PRESETS_H 26 | #define LV2_PRESETS_H 27 | 28 | #define LV2_PRESETS_URI "http://lv2plug.in/ns/ext/presets" 29 | #define LV2_PRESETS_PREFIX LV2_PRESETS_URI "#" 30 | 31 | #define LV2_PRESETS__Bank LV2_PRESETS_PREFIX "Bank" 32 | #define LV2_PRESETS__Preset LV2_PRESETS_PREFIX "Preset" 33 | #define LV2_PRESETS__bank LV2_PRESETS_PREFIX "bank" 34 | #define LV2_PRESETS__preset LV2_PRESETS_PREFIX "preset" 35 | #define LV2_PRESETS__value LV2_PRESETS_PREFIX "value" 36 | 37 | #endif /* LV2_PRESETS_H */ 38 | 39 | /** 40 | @} 41 | */ 42 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/morph/morph.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup morph Morph 19 | 20 | Ports that can dynamically change type, see 21 | for details. 22 | 23 | @{ 24 | */ 25 | 26 | #ifndef LV2_MORPH_H 27 | #define LV2_MORPH_H 28 | 29 | #define LV2_MORPH_URI "http://lv2plug.in/ns/ext/morph" 30 | #define LV2_MORPH_PREFIX LV2_MORPH_URI "#" 31 | 32 | #define LV2_MORPH__AutoMorphPort LV2_MORPH_PREFIX "AutoMorphPort" 33 | #define LV2_MORPH__MorphPort LV2_MORPH_PREFIX "MorphPort" 34 | #define LV2_MORPH__interface LV2_MORPH_PREFIX "interface" 35 | #define LV2_MORPH__supportsType LV2_MORPH_PREFIX "supportsType" 36 | #define LV2_MORPH__currentType LV2_MORPH_PREFIX "currentType" 37 | 38 | #endif /* LV2_MORPH_H */ 39 | 40 | /** 41 | @} 42 | */ 43 | -------------------------------------------------------------------------------- /lib/lilv/scalepoint.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007-2014 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include "lilv_internal.h" 18 | 19 | /** Ownership of value and label is taken */ 20 | LilvScalePoint* 21 | lilv_scale_point_new(LilvNode* value, LilvNode* label) 22 | { 23 | LilvScalePoint* point = (LilvScalePoint*)malloc(sizeof(LilvScalePoint)); 24 | point->value = value; 25 | point->label = label; 26 | return point; 27 | } 28 | 29 | void 30 | lilv_scale_point_free(LilvScalePoint* point) 31 | { 32 | if (point) { 33 | lilv_node_free(point->value); 34 | lilv_node_free(point->label); 35 | free(point); 36 | } 37 | } 38 | 39 | LILV_API const LilvNode* 40 | lilv_scale_point_get_value(const LilvScalePoint* p) 41 | { 42 | return p->value; 43 | } 44 | 45 | LILV_API const LilvNode* 46 | lilv_scale_point_get_label(const LilvScalePoint* p) 47 | { 48 | return p->label; 49 | } 50 | -------------------------------------------------------------------------------- /lib/pthreads-w32/fork.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fork.c 3 | * 4 | * Description: 5 | * Implementation of fork() for POSIX threads. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sync.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sync.c 3 | * 4 | * Description: 5 | * This translation unit implements functions related to thread 6 | * synchronisation. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | #include "pthread_detach.c" 43 | #include "pthread_join.c" 44 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_getconcurrency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getconcurrency.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_getconcurrency (void) 43 | { 44 | return ptw32_concurrency; 45 | } 46 | -------------------------------------------------------------------------------- /lib/sord/sord_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2011-2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef SORD_SORD_INTERNAL_H 18 | #define SORD_SORD_INTERNAL_H 19 | 20 | #include 21 | #include 22 | 23 | #include "sord/sord.h" 24 | 25 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 26 | # define SORD_UNREACHABLE() __builtin_unreachable() 27 | #else 28 | # define SORD_UNREACHABLE() assert(false) 29 | #endif 30 | 31 | /** Resource node metadata */ 32 | typedef struct { 33 | size_t refs_as_obj; ///< References as a quad object 34 | } SordResourceMetadata; 35 | 36 | /** Literal node metadata */ 37 | typedef struct { 38 | SordNode* datatype; ///< Optional literal data type URI 39 | char lang[16]; ///< Optional language tag 40 | } SordLiteralMetadata; 41 | 42 | /** Node */ 43 | struct SordNodeImpl { 44 | SerdNode node; ///< Serd node 45 | size_t refs; ///< Reference count (# of containing quads) 46 | union { 47 | SordResourceMetadata res; 48 | SordLiteralMetadata lit; 49 | } meta; 50 | }; 51 | 52 | #endif /* SORD_SORD_INTERNAL_H */ 53 | -------------------------------------------------------------------------------- /lib/pthreads-w32/exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * exit.c 3 | * 4 | * Description: 5 | * This translation unit implements routines associated with exiting from 6 | * a thread. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | #if ! defined(_UWIN) && ! defined(WINCE) 41 | # include 42 | #endif 43 | 44 | #include "pthread_exit.c" 45 | -------------------------------------------------------------------------------- /lib/pthreads-w32/cancel.c: -------------------------------------------------------------------------------- 1 | /* 2 | * cancel.c 3 | * 4 | * Description: 5 | * POSIX thread functions related to thread cancellation. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_setcancelstate.c" 42 | #include "pthread_setcanceltype.c" 43 | #include "pthread_testcancel.c" 44 | #include "pthread_cancel.c" 45 | -------------------------------------------------------------------------------- /lib/pthreads-w32/tsd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tsd.c 3 | * 4 | * Description: 5 | * POSIX thread functions which implement thread-specific data (TSD). 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_key_create.c" 42 | #include "pthread_key_delete.c" 43 | #include "pthread_setspecific.c" 44 | #include "pthread_getspecific.c" 45 | -------------------------------------------------------------------------------- /lib/sord/zix/digest.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012-2014 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include "zix/digest.h" 18 | 19 | #ifdef __SSE4_2__ 20 | # include 21 | #endif 22 | 23 | ZIX_API uint32_t 24 | zix_digest_start(void) 25 | { 26 | #ifdef __SSE4_2__ 27 | return 1; // CRC32 initial value 28 | #else 29 | return 5381; // DJB hash initial value 30 | #endif 31 | } 32 | 33 | ZIX_API uint32_t 34 | zix_digest_add(uint32_t hash, const void* const buf, const size_t len) 35 | { 36 | const uint8_t* str = (const uint8_t*)buf; 37 | #ifdef __SSE4_2__ 38 | // SSE 4.2 CRC32 39 | for (size_t i = 0; i < (len / sizeof(uint32_t)); ++i) { 40 | hash = _mm_crc32_u32(hash, *(const uint32_t*)str); 41 | str += sizeof(uint32_t); 42 | } 43 | if (len & sizeof(uint16_t)) { 44 | hash = _mm_crc32_u16(hash, *(const uint16_t*)str); 45 | str += sizeof(uint16_t); 46 | } 47 | if (len & sizeof(uint8_t)) { 48 | hash = _mm_crc32_u8(hash, *(const uint8_t*)str); 49 | } 50 | #else 51 | // Classic DJB hash 52 | for (size_t i = 0; i < len; ++i) { 53 | hash = (hash << 5) + hash + str[i]; 54 | } 55 | #endif 56 | return hash; 57 | } 58 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_getunique_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getunique_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* 41 | * 42 | */ 43 | unsigned __int64 44 | pthread_getunique_np (pthread_t thread) 45 | { 46 | return ((ptw32_thread_t*)thread.p)->seqNumber; 47 | } 48 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_mutexattr_getkind_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_getkind_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | pthread_mutexattr_getkind_np (pthread_mutexattr_t * attr, int *kind) 42 | { 43 | return pthread_mutexattr_gettype (attr, kind); 44 | } 45 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_mutexattr_setkind_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_setkind_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | pthread_mutexattr_setkind_np (pthread_mutexattr_t * attr, int kind) 42 | { 43 | return pthread_mutexattr_settype (attr, kind); 44 | } 45 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/buf-size/buf-size.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007-2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef LV2_BUF_SIZE_H 18 | #define LV2_BUF_SIZE_H 19 | 20 | /** 21 | @defgroup buf-size Buffer Size 22 | 23 | Access to, and restrictions on, buffer sizes; see 24 | for details. 25 | 26 | @{ 27 | */ 28 | 29 | #define LV2_BUF_SIZE_URI "http://lv2plug.in/ns/ext/buf-size" 30 | #define LV2_BUF_SIZE_PREFIX LV2_BUF_SIZE_URI "#" 31 | 32 | #define LV2_BUF_SIZE__boundedBlockLength LV2_BUF_SIZE_PREFIX "boundedBlockLength" 33 | #define LV2_BUF_SIZE__fixedBlockLength LV2_BUF_SIZE_PREFIX "fixedBlockLength" 34 | #define LV2_BUF_SIZE__maxBlockLength LV2_BUF_SIZE_PREFIX "maxBlockLength" 35 | #define LV2_BUF_SIZE__minBlockLength LV2_BUF_SIZE_PREFIX "minBlockLength" 36 | #define LV2_BUF_SIZE__nominalBlockLength LV2_BUF_SIZE_PREFIX "nominalBlockLength" 37 | #define LV2_BUF_SIZE__powerOf2BlockLength LV2_BUF_SIZE_PREFIX "powerOf2BlockLength" 38 | #define LV2_BUF_SIZE__sequenceSize LV2_BUF_SIZE_PREFIX "sequenceSize" 39 | 40 | /** 41 | @} 42 | */ 43 | 44 | #endif /* LV2_BUF_SIZE_H */ 45 | -------------------------------------------------------------------------------- /lib/pthreads-w32/spin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spin.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "ptw32_spinlock_check_need_init.c" 42 | #include "pthread_spin_init.c" 43 | #include "pthread_spin_destroy.c" 44 | #include "pthread_spin_lock.c" 45 | #include "pthread_spin_unlock.c" 46 | #include "pthread_spin_trylock.c" 47 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_setconcurrency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_setconcurrency.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_setconcurrency (int level) 43 | { 44 | if (level < 0) 45 | { 46 | return EINVAL; 47 | } 48 | else 49 | { 50 | ptw32_concurrency = level; 51 | return 0; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_is_attr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_is_attr.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | ptw32_is_attr (const pthread_attr_t * attr) 42 | { 43 | /* Return 0 if the attr object is valid, non-zero otherwise. */ 44 | 45 | return (attr == NULL || 46 | *attr == NULL || (*attr)->valid != PTW32_ATTR_VALID); 47 | } 48 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_calloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_calloc.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #if defined(NEED_CALLOC) 42 | void * 43 | ptw32_calloc (size_t n, size_t s) 44 | { 45 | unsigned int m = n * s; 46 | void *p; 47 | 48 | p = malloc (m); 49 | if (p == NULL) 50 | return NULL; 51 | 52 | memset (p, 0, m); 53 | 54 | return p; 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /lib/pthreads-w32/barrier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * barrier.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_barrier_init.c" 42 | #include "pthread_barrier_destroy.c" 43 | #include "pthread_barrier_wait.c" 44 | #include "pthread_barrierattr_init.c" 45 | #include "pthread_barrierattr_destroy.c" 46 | #include "pthread_barrierattr_getpshared.c" 47 | #include "pthread_barrierattr_setpshared.c" 48 | -------------------------------------------------------------------------------- /lib/pthreads-w32/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * misc.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_kill.c" 42 | #include "pthread_once.c" 43 | #include "pthread_self.c" 44 | #include "pthread_equal.c" 45 | #include "pthread_setconcurrency.c" 46 | #include "pthread_getconcurrency.c" 47 | #include "ptw32_new.c" 48 | #include "ptw32_calloc.c" 49 | #include "ptw32_reuse.c" 50 | #include "w32_CancelableWait.c" 51 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_getinheritsched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getinheritsched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getinheritsched (const pthread_attr_t * attr, int *inheritsched) 43 | { 44 | if (ptw32_is_attr (attr) != 0 || inheritsched == NULL) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | *inheritsched = (*attr)->inheritsched; 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_setschedpolicy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setschedpolicy.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setschedpolicy (pthread_attr_t * attr, int policy) 43 | { 44 | if (ptw32_is_attr (attr) != 0) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | if (policy != SCHED_OTHER) 50 | { 51 | return ENOTSUP; 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_num_processors_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_num_processors_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* 41 | * pthread_num_processors_np() 42 | * 43 | * Get the number of CPUs available to the process. 44 | */ 45 | int 46 | pthread_num_processors_np (void) 47 | { 48 | int count; 49 | 50 | if (ptw32_getprocessors (&count) != 0) 51 | { 52 | count = 1; 53 | } 54 | 55 | return (count); 56 | } 57 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_getschedparam.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getschedparam.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getschedparam (const pthread_attr_t * attr, 43 | struct sched_param *param) 44 | { 45 | if (ptw32_is_attr (attr) != 0 || param == NULL) 46 | { 47 | return EINVAL; 48 | } 49 | 50 | memcpy (param, &(*attr)->param, sizeof (*param)); 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /lib/pthreads-w32/nonportable.c: -------------------------------------------------------------------------------- 1 | /* 2 | * nonportable.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | #include "pthread_mutexattr_setkind_np.c" 41 | #include "pthread_mutexattr_getkind_np.c" 42 | #include "pthread_getw32threadhandle_np.c" 43 | #include "pthread_getunique_np.c" 44 | #include "pthread_delay_np.c" 45 | #include "pthread_num_processors_np.c" 46 | #include "pthread_win32_attach_detach_np.c" 47 | #include "pthread_timechange_handler_np.c" 48 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_mutexattr_gettype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_gettype.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind) 43 | { 44 | int result = 0; 45 | 46 | if (attr != NULL && *attr != NULL && kind != NULL) 47 | { 48 | *kind = (*attr)->kind; 49 | } 50 | else 51 | { 52 | result = EINVAL; 53 | } 54 | 55 | return (result); 56 | } 57 | -------------------------------------------------------------------------------- /lib/pthreads-w32/condvar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * condvar.c 3 | * 4 | * Description: 5 | * This translation unit implements condition variables and their primitives. 6 | * 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | * 37 | */ 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | #include "ptw32_cond_check_need_init.c" 43 | #include "pthread_condattr_init.c" 44 | #include "pthread_condattr_destroy.c" 45 | #include "pthread_condattr_getpshared.c" 46 | #include "pthread_condattr_setpshared.c" 47 | #include "pthread_cond_init.c" 48 | #include "pthread_cond_destroy.c" 49 | #include "pthread_cond_wait.c" 50 | #include "pthread_cond_signal.c" 51 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_rwlock_cancelwrwait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_rwlock_cancelwrwait.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | void 41 | ptw32_rwlock_cancelwrwait (void *arg) 42 | { 43 | pthread_rwlock_t rwl = (pthread_rwlock_t) arg; 44 | 45 | rwl->nSharedAccessCount = -rwl->nCompletedSharedAccessCount; 46 | rwl->nCompletedSharedAccessCount = 0; 47 | 48 | (void) pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); 49 | (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); 50 | } 51 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_getscope.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getscope.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* ignore warning "unreferenced formal parameter" */ 41 | #if defined(_MSC_VER) 42 | #pragma warning( disable : 4100 ) 43 | #endif 44 | 45 | int 46 | pthread_attr_getscope (const pthread_attr_t * attr, int *contentionscope) 47 | { 48 | #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) 49 | *contentionscope = (*attr)->contentionscope; 50 | return 0; 51 | #else 52 | return ENOSYS; 53 | #endif 54 | } 55 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_setinheritsched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setinheritsched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setinheritsched (pthread_attr_t * attr, int inheritsched) 43 | { 44 | if (ptw32_is_attr (attr) != 0) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | if (PTHREAD_INHERIT_SCHED != inheritsched 50 | && PTHREAD_EXPLICIT_SCHED != inheritsched) 51 | { 52 | return EINVAL; 53 | } 54 | 55 | (*attr)->inheritsched = inheritsched; 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/time/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2011 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup time Time 19 | 20 | Properties for describing time, see for 21 | details. 22 | 23 | Note the time extension is purely data, this header merely defines URIs for 24 | convenience. 25 | 26 | @{ 27 | */ 28 | 29 | #ifndef LV2_TIME_H 30 | #define LV2_TIME_H 31 | 32 | #define LV2_TIME_URI "http://lv2plug.in/ns/ext/time" 33 | #define LV2_TIME_PREFIX LV2_TIME_URI "#" 34 | 35 | #define LV2_TIME__Time LV2_TIME_PREFIX "Time" 36 | #define LV2_TIME__Position LV2_TIME_PREFIX "Position" 37 | #define LV2_TIME__Rate LV2_TIME_PREFIX "Rate" 38 | #define LV2_TIME__position LV2_TIME_PREFIX "position" 39 | #define LV2_TIME__barBeat LV2_TIME_PREFIX "barBeat" 40 | #define LV2_TIME__bar LV2_TIME_PREFIX "bar" 41 | #define LV2_TIME__beat LV2_TIME_PREFIX "beat" 42 | #define LV2_TIME__beatUnit LV2_TIME_PREFIX "beatUnit" 43 | #define LV2_TIME__beatsPerBar LV2_TIME_PREFIX "beatsPerBar" 44 | #define LV2_TIME__beatsPerMinute LV2_TIME_PREFIX "beatsPerMinute" 45 | #define LV2_TIME__frame LV2_TIME_PREFIX "frame" 46 | #define LV2_TIME__framesPerSecond LV2_TIME_PREFIX "framesPerSecond" 47 | #define LV2_TIME__speed LV2_TIME_PREFIX "speed" 48 | 49 | /** 50 | @} 51 | */ 52 | 53 | #endif /* LV2_TIME_H */ 54 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sem_close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_close.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #if defined(_MSC_VER) 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_close (sem_t * sem) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_close */ 59 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_getschedpolicy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getschedpolicy.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getschedpolicy (const pthread_attr_t * attr, int *policy) 43 | { 44 | if (ptw32_is_attr (attr) != 0 || policy == NULL) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | /* 50 | * Validate the policy arg. 51 | * Check that a policy constant wasn't passed rather than &policy. 52 | */ 53 | if (policy <= (int *) SCHED_MAX) 54 | { 55 | return EINVAL; 56 | } 57 | 58 | *policy = SCHED_OTHER; 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sem_unlink.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_unlink.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #if defined(_MSC_VER) 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_unlink (const char *name) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_unlink */ 59 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | #include "pthread_attr_setschedpolicy.c" 42 | #include "pthread_attr_getschedpolicy.c" 43 | #include "pthread_attr_setschedparam.c" 44 | #include "pthread_attr_getschedparam.c" 45 | #include "pthread_attr_setinheritsched.c" 46 | #include "pthread_attr_getinheritsched.c" 47 | #include "pthread_setschedparam.c" 48 | #include "pthread_getschedparam.c" 49 | #include "sched_get_priority_max.c" 50 | #include "sched_get_priority_min.c" 51 | #include "sched_setscheduler.c" 52 | #include "sched_getscheduler.c" 53 | #include "sched_yield.c" 54 | -------------------------------------------------------------------------------- /src/worker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Robin Gareus 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _worker_h_ 20 | #define _worker_h_ 21 | 22 | #include 23 | #include "lv2/lv2plug.in/ns/lv2core/lv2.h" 24 | #include "lv2/lv2plug.in/ns/ext/worker/worker.h" 25 | 26 | #include "ringbuffer.h" 27 | 28 | class Lv2Worker 29 | { 30 | public: 31 | Lv2Worker (const LV2_Worker_Interface* iface, LV2_Handle handle); 32 | ~Lv2Worker (); 33 | 34 | static LV2_Worker_Status lv2_worker_schedule ( 35 | LV2_Worker_Schedule_Handle handle, 36 | uint32_t size, 37 | const void* data) 38 | { 39 | Lv2Worker* self = (Lv2Worker*) handle; 40 | return self->schedule (size, data); 41 | } 42 | 43 | LV2_Worker_Status schedule (uint32_t size, const void* data); 44 | LV2_Worker_Status respond (uint32_t size, const void* data); 45 | void emit_response (); 46 | void set_freewheeling (bool yn) { _freewheeling = yn; } 47 | void run (); 48 | void end_run () { 49 | if (_iface->end_run) { 50 | _iface->end_run (_handle); 51 | } 52 | } 53 | 54 | private: 55 | Lv2VstUtil::RingBuffer _requests; 56 | Lv2VstUtil::RingBuffer _responses; 57 | 58 | const LV2_Worker_Interface* _iface; 59 | LV2_Handle _handle; 60 | 61 | pthread_t _thread; 62 | pthread_mutex_t _lock; 63 | pthread_cond_t _ready; 64 | volatile bool _run; 65 | bool _freewheeling; 66 | }; 67 | #endif 68 | -------------------------------------------------------------------------------- /lib/pthreads-w32/private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * private.c 3 | * 4 | * Description: 5 | * This translation unit implements routines which are private to 6 | * the implementation and may be used throughout it. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | #include "ptw32_MCS_lock.c" 42 | #include "ptw32_is_attr.c" 43 | #include "ptw32_processInitialize.c" 44 | #include "ptw32_processTerminate.c" 45 | #include "ptw32_threadStart.c" 46 | #include "ptw32_threadDestroy.c" 47 | #include "ptw32_tkAssocCreate.c" 48 | #include "ptw32_tkAssocDestroy.c" 49 | #include "ptw32_callUserDestroyRoutines.c" 50 | #include "ptw32_semwait.c" 51 | #include "ptw32_timespec.c" 52 | #include "ptw32_relmillisecs.c" 53 | #include "ptw32_throw.c" 54 | #include "ptw32_getprocessors.c" 55 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/port-props/port-props.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup port-props Port Properties 19 | 20 | Various port properties. 21 | 22 | @{ 23 | */ 24 | 25 | #ifndef LV2_PORT_PROPS_H 26 | #define LV2_PORT_PROPS_H 27 | 28 | #define LV2_PORT_PROPS_URI "http://lv2plug.in/ns/ext/port-props" 29 | #define LV2_PORT_PROPS_PREFIX LV2_PORT_PROPS_URI "#" 30 | 31 | #define LV2_PORT_PROPS__causesArtifacts LV2_PORT_PROPS_PREFIX "causesArtifacts" 32 | #define LV2_PORT_PROPS__continuousCV LV2_PORT_PROPS_PREFIX "continuousCV" 33 | #define LV2_PORT_PROPS__discreteCV LV2_PORT_PROPS_PREFIX "discreteCV" 34 | #define LV2_PORT_PROPS__displayPriority LV2_PORT_PROPS_PREFIX "displayPriority" 35 | #define LV2_PORT_PROPS__expensive LV2_PORT_PROPS_PREFIX "expensive" 36 | #define LV2_PORT_PROPS__hasStrictBounds LV2_PORT_PROPS_PREFIX "hasStrictBounds" 37 | #define LV2_PORT_PROPS__logarithmic LV2_PORT_PROPS_PREFIX "logarithmic" 38 | #define LV2_PORT_PROPS__notAutomatic LV2_PORT_PROPS_PREFIX "notAutomatic" 39 | #define LV2_PORT_PROPS__notOnGUI LV2_PORT_PROPS_PREFIX "notOnGUI" 40 | #define LV2_PORT_PROPS__rangeSteps LV2_PORT_PROPS_PREFIX "rangeSteps" 41 | #define LV2_PORT_PROPS__supportsStrictBounds LV2_PORT_PROPS_PREFIX "supportsStrictBounds" 42 | #define LV2_PORT_PROPS__trigger LV2_PORT_PROPS_PREFIX "trigger" 43 | 44 | #endif /* LV2_PORT_PROPS_H */ 45 | 46 | /** 47 | @} 48 | */ 49 | -------------------------------------------------------------------------------- /lib/pthreads-w32/attr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * attr.c 3 | * 4 | * Description: 5 | * This translation unit agregates operations on thread attribute objects. 6 | * It is used for inline optimisation. 7 | * 8 | * The included modules are used separately when static executable sizes 9 | * must be minimised. 10 | * 11 | * -------------------------------------------------------------------------- 12 | * 13 | * Pthreads-win32 - POSIX Threads Library for Win32 14 | * Copyright(C) 1998 John E. Bossom 15 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 16 | * 17 | * Contact Email: rpj@callisto.canberra.edu.au 18 | * 19 | * The current list of contributors is contained 20 | * in the file CONTRIBUTORS included with the source 21 | * code distribution. The list can also be seen at the 22 | * following World Wide Web location: 23 | * http://sources.redhat.com/pthreads-win32/contributors.html 24 | * 25 | * This library is free software; you can redistribute it and/or 26 | * modify it under the terms of the GNU Lesser General Public 27 | * License as published by the Free Software Foundation; either 28 | * version 2 of the License, or (at your option) any later version. 29 | * 30 | * This library is distributed in the hope that it will be useful, 31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 | * Lesser General Public License for more details. 34 | * 35 | * You should have received a copy of the GNU Lesser General Public 36 | * License along with this library in the file COPYING.LIB; 37 | * if not, write to the Free Software Foundation, Inc., 38 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 39 | */ 40 | 41 | #include "pthread.h" 42 | #include "implement.h" 43 | 44 | #include "pthread_attr_init.c" 45 | #include "pthread_attr_destroy.c" 46 | #include "pthread_attr_getdetachstate.c" 47 | #include "pthread_attr_setdetachstate.c" 48 | #include "pthread_attr_getstackaddr.c" 49 | #include "pthread_attr_setstackaddr.c" 50 | #include "pthread_attr_getstacksize.c" 51 | #include "pthread_attr_setstacksize.c" 52 | #include "pthread_attr_getscope.c" 53 | #include "pthread_attr_setscope.c" 54 | -------------------------------------------------------------------------------- /lib/pthreads-w32/rwlock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rwlock.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "ptw32_rwlock_check_need_init.c" 38 | #include "ptw32_rwlock_cancelwrwait.c" 39 | #include "pthread_rwlock_init.c" 40 | #include "pthread_rwlock_destroy.c" 41 | #include "pthread_rwlockattr_init.c" 42 | #include "pthread_rwlockattr_destroy.c" 43 | #include "pthread_rwlockattr_getpshared.c" 44 | #include "pthread_rwlockattr_setpshared.c" 45 | #include "pthread_rwlock_rdlock.c" 46 | #include "pthread_rwlock_timedrdlock.c" 47 | #include "pthread_rwlock_wrlock.c" 48 | #include "pthread_rwlock_timedwrlock.c" 49 | #include "pthread_rwlock_unlock.c" 50 | #include "pthread_rwlock_tryrdlock.c" 51 | #include "pthread_rwlock_trywrlock.c" 52 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sem_open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_open.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #if defined(_MSC_VER) 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_open (const char *name, int oflag, mode_t mode, unsigned int value) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_open */ 59 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_setscope.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setscope.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* ignore warning "unreferenced formal parameter" */ 41 | #if defined(_MSC_VER) 42 | #pragma warning( disable : 4100 ) 43 | #endif 44 | 45 | int 46 | pthread_attr_setscope (pthread_attr_t * attr, int contentionscope) 47 | { 48 | #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) 49 | switch (contentionscope) 50 | { 51 | case PTHREAD_SCOPE_SYSTEM: 52 | (*attr)->contentionscope = contentionscope; 53 | return 0; 54 | case PTHREAD_SCOPE_PROCESS: 55 | return ENOTSUP; 56 | default: 57 | return EINVAL; 58 | } 59 | #else 60 | return ENOSYS; 61 | #endif 62 | } 63 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_setschedparam.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setschedparam.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setschedparam (pthread_attr_t * attr, 43 | const struct sched_param *param) 44 | { 45 | int priority; 46 | 47 | if (ptw32_is_attr (attr) != 0 || param == NULL) 48 | { 49 | return EINVAL; 50 | } 51 | 52 | priority = param->sched_priority; 53 | 54 | /* Validate priority level. */ 55 | if (priority < sched_get_priority_min (SCHED_OTHER) || 56 | priority > sched_get_priority_max (SCHED_OTHER)) 57 | { 58 | return EINVAL; 59 | } 60 | 61 | memcpy (&(*attr)->param, param, sizeof (*param)); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/data-access/data-access.h: -------------------------------------------------------------------------------- 1 | /* 2 | LV2 Data Access Extension 3 | Copyright 2008-2011 David Robillard 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | /** 19 | @defgroup data-access Data Access 20 | 21 | Access to plugin extension_data() for UIs, see 22 | for details. 23 | 24 | @{ 25 | */ 26 | 27 | #ifndef LV2_DATA_ACCESS_H 28 | #define LV2_DATA_ACCESS_H 29 | 30 | #define LV2_DATA_ACCESS_URI "http://lv2plug.in/ns/ext/data-access" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | The data field of the LV2_Feature for this extension. 38 | 39 | To support this feature the host must pass an LV2_Feature struct to the 40 | instantiate method with URI "http://lv2plug.in/ns/ext/data-access" 41 | and data pointed to an instance of this struct. 42 | */ 43 | typedef struct { 44 | /** 45 | A pointer to a method the UI can call to get data (of a type specified 46 | by some other extension) from the plugin. 47 | 48 | This call never is never guaranteed to return anything, UIs should 49 | degrade gracefully if direct access to the plugin data is not possible 50 | (in which case this function will return NULL). 51 | 52 | This is for access to large data that can only possibly work if the UI 53 | and plugin are running in the same process. For all other things, use 54 | the normal LV2 UI communication system. 55 | */ 56 | const void* (*data_access)(const char* uri); 57 | } LV2_Extension_Data_Feature; 58 | 59 | #ifdef __cplusplus 60 | } /* extern "C" */ 61 | #endif 62 | 63 | #endif /* LV2_DATA_ACCESS_H */ 64 | 65 | /** 66 | @} 67 | */ 68 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_getw32threadhandle_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getw32threadhandle_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* 41 | * pthread_getw32threadhandle_np() 42 | * 43 | * Returns the win32 thread handle that the POSIX 44 | * thread "thread" is running as. 45 | * 46 | * Applications can use the win32 handle to set 47 | * win32 specific attributes of the thread. 48 | */ 49 | HANDLE 50 | pthread_getw32threadhandle_np (pthread_t thread) 51 | { 52 | return ((ptw32_thread_t *)thread.p)->threadH; 53 | } 54 | 55 | /* 56 | * pthread_getw32threadid_np() 57 | * 58 | * Returns the win32 thread id that the POSIX 59 | * thread "thread" is running as. 60 | */ 61 | DWORD 62 | pthread_getw32threadid_np (pthread_t thread) 63 | { 64 | return ((ptw32_thread_t *)thread.p)->thread; 65 | } 66 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread.c 3 | * 4 | * Description: 5 | * This translation unit agregates pthreads-win32 translation units. 6 | * It is used for inline optimisation of the library, 7 | * maximising for speed at the expense of size. 8 | * 9 | * -------------------------------------------------------------------------- 10 | * 11 | * Pthreads-win32 - POSIX Threads Library for Win32 12 | * Copyright(C) 1998 John E. Bossom 13 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 14 | * 15 | * Contact Email: rpj@callisto.canberra.edu.au 16 | * 17 | * The current list of contributors is contained 18 | * in the file CONTRIBUTORS included with the source 19 | * code distribution. The list can also be seen at the 20 | * following World Wide Web location: 21 | * http://sources.redhat.com/pthreads-win32/contributors.html 22 | * 23 | * This library is free software; you can redistribute it and/or 24 | * modify it under the terms of the GNU Lesser General Public 25 | * License as published by the Free Software Foundation; either 26 | * version 2 of the License, or (at your option) any later version. 27 | * 28 | * This library is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 31 | * Lesser General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU Lesser General Public 34 | * License along with this library in the file COPYING.LIB; 35 | * if not, write to the Free Software Foundation, Inc., 36 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 37 | */ 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | /* The following are ordered for inlining */ 43 | 44 | #include "private.c" 45 | #include "attr.c" 46 | #include "barrier.c" 47 | #include "cancel.c" 48 | #include "cleanup.c" 49 | #include "condvar.c" 50 | #include "create.c" 51 | #include "dll.c" 52 | #include "autostatic.c" 53 | #include "errno.c" 54 | #include "exit.c" 55 | #include "fork.c" 56 | #include "global.c" 57 | #include "misc.c" 58 | #include "mutex.c" 59 | #include "nonportable.c" 60 | #include "rwlock.c" 61 | #include "sched.c" 62 | #include "semaphore.c" 63 | #include "signal.c" 64 | #include "spin.c" 65 | #include "sync.c" 66 | #include "tsd.c" 67 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sched_getscheduler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched_getscheduler.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | sched_getscheduler (pid_t pid) 43 | { 44 | /* 45 | * Win32 only has one policy which we call SCHED_OTHER. 46 | * However, we try to provide other valid side-effects 47 | * such as EPERM and ESRCH errors. 48 | */ 49 | if (0 != pid) 50 | { 51 | int selfPid = (int) GetCurrentProcessId (); 52 | 53 | if (pid != selfPid) 54 | { 55 | HANDLE h = 56 | OpenProcess (PROCESS_QUERY_INFORMATION, PTW32_FALSE, (DWORD) pid); 57 | 58 | if (NULL == h) 59 | { 60 | errno = 61 | (GetLastError () == 62 | (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; 63 | return -1; 64 | } 65 | else 66 | CloseHandle(h); 67 | } 68 | } 69 | 70 | return SCHED_OTHER; 71 | } 72 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_barrier_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_barrier_init.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_barrier_init (pthread_barrier_t * barrier, 43 | const pthread_barrierattr_t * attr, unsigned int count) 44 | { 45 | pthread_barrier_t b; 46 | 47 | if (barrier == NULL || count == 0) 48 | { 49 | return EINVAL; 50 | } 51 | 52 | if (NULL != (b = (pthread_barrier_t) calloc (1, sizeof (*b)))) 53 | { 54 | b->pshared = (attr != NULL && *attr != NULL 55 | ? (*attr)->pshared : PTHREAD_PROCESS_PRIVATE); 56 | 57 | b->nCurrentBarrierHeight = b->nInitialBarrierHeight = count; 58 | b->lock = 0; 59 | 60 | if (0 == sem_init (&(b->semBarrierBreeched), b->pshared, 0)) 61 | { 62 | *barrier = b; 63 | return 0; 64 | } 65 | (void) free (b); 66 | } 67 | 68 | return ENOMEM; 69 | } 70 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_spin_unlock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_spin_unlock.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_spin_unlock (pthread_spinlock_t * lock) 43 | { 44 | register pthread_spinlock_t s; 45 | 46 | if (NULL == lock || NULL == *lock) 47 | { 48 | return (EINVAL); 49 | } 50 | 51 | s = *lock; 52 | 53 | if (s == PTHREAD_SPINLOCK_INITIALIZER) 54 | { 55 | return EPERM; 56 | } 57 | 58 | switch ((long) 59 | PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG ((PTW32_INTERLOCKED_LONGPTR) &s->interlock, 60 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_UNLOCKED, 61 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED)) 62 | { 63 | case PTW32_SPIN_LOCKED: 64 | case PTW32_SPIN_UNLOCKED: 65 | return 0; 66 | case PTW32_SPIN_USE_MUTEX: 67 | return pthread_mutex_unlock (&(s->u.mutex)); 68 | } 69 | 70 | return EINVAL; 71 | } 72 | -------------------------------------------------------------------------------- /lib/pthreads-w32/mutex.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #if ! defined(_UWIN) && ! defined(WINCE) 38 | # include 39 | #endif 40 | #if !defined(NEED_FTIME) 41 | #include 42 | #endif 43 | #include "pthread.h" 44 | #include "implement.h" 45 | 46 | 47 | #include "ptw32_mutex_check_need_init.c" 48 | #include "pthread_mutex_init.c" 49 | #include "pthread_mutex_destroy.c" 50 | #include "pthread_mutexattr_init.c" 51 | #include "pthread_mutexattr_destroy.c" 52 | #include "pthread_mutexattr_getpshared.c" 53 | #include "pthread_mutexattr_setpshared.c" 54 | #include "pthread_mutexattr_settype.c" 55 | #include "pthread_mutexattr_gettype.c" 56 | #include "pthread_mutexattr_setrobust.c" 57 | #include "pthread_mutexattr_getrobust.c" 58 | #include "pthread_mutex_lock.c" 59 | #include "pthread_mutex_timedlock.c" 60 | #include "pthread_mutex_unlock.c" 61 | #include "pthread_mutex_trylock.c" 62 | #include "pthread_mutex_consistent.c" 63 | -------------------------------------------------------------------------------- /lib/lilv/zix/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2011 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef ZIX_COMMON_H 18 | #define ZIX_COMMON_H 19 | 20 | /** 21 | @addtogroup zix 22 | @{ 23 | */ 24 | 25 | /** @cond */ 26 | #ifdef ZIX_SHARED 27 | # ifdef _WIN32 28 | # define ZIX_LIB_IMPORT __declspec(dllimport) 29 | # define ZIX_LIB_EXPORT __declspec(dllexport) 30 | # else 31 | # define ZIX_LIB_IMPORT __attribute__((visibility("default"))) 32 | # define ZIX_LIB_EXPORT __attribute__((visibility("default"))) 33 | # endif 34 | # ifdef ZIX_INTERNAL 35 | # define ZIX_API ZIX_LIB_EXPORT 36 | # else 37 | # define ZIX_API ZIX_LIB_IMPORT 38 | # endif 39 | # define ZIX_PRIVATE static 40 | #elif defined(ZIX_INLINE) 41 | # define ZIX_API static inline 42 | # define ZIX_PRIVATE static inline 43 | #else 44 | # define ZIX_API 45 | # define ZIX_PRIVATE static 46 | #endif 47 | /** @endcond */ 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #else 52 | # include 53 | #endif 54 | 55 | typedef enum { 56 | ZIX_STATUS_SUCCESS, 57 | ZIX_STATUS_ERROR, 58 | ZIX_STATUS_NO_MEM, 59 | ZIX_STATUS_NOT_FOUND, 60 | ZIX_STATUS_EXISTS, 61 | ZIX_STATUS_BAD_ARG, 62 | ZIX_STATUS_BAD_PERMS 63 | } ZixStatus; 64 | 65 | /** 66 | Function for comparing two elements. 67 | */ 68 | typedef int (*ZixComparator)(const void* a, const void* b, void* user_data); 69 | 70 | /** 71 | Function for testing equality of two elements. 72 | */ 73 | typedef bool (*ZixEqualFunc)(const void* a, const void* b); 74 | 75 | /** 76 | Function to destroy an element. 77 | */ 78 | typedef void (*ZixDestroyFunc)(void* ptr); 79 | 80 | /** 81 | @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } /* extern "C" */ 86 | #endif 87 | 88 | #endif /* ZIX_COMMON_H */ 89 | -------------------------------------------------------------------------------- /lib/sord/zix/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2011 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef ZIX_COMMON_H 18 | #define ZIX_COMMON_H 19 | 20 | /** 21 | @addtogroup zix 22 | @{ 23 | */ 24 | 25 | /** @cond */ 26 | #ifdef ZIX_SHARED 27 | # ifdef _WIN32 28 | # define ZIX_LIB_IMPORT __declspec(dllimport) 29 | # define ZIX_LIB_EXPORT __declspec(dllexport) 30 | # else 31 | # define ZIX_LIB_IMPORT __attribute__((visibility("default"))) 32 | # define ZIX_LIB_EXPORT __attribute__((visibility("default"))) 33 | # endif 34 | # ifdef ZIX_INTERNAL 35 | # define ZIX_API ZIX_LIB_EXPORT 36 | # else 37 | # define ZIX_API ZIX_LIB_IMPORT 38 | # endif 39 | # define ZIX_PRIVATE static 40 | #elif defined(ZIX_INLINE) 41 | # define ZIX_API static inline 42 | # define ZIX_PRIVATE static inline 43 | #else 44 | # define ZIX_API 45 | # define ZIX_PRIVATE static 46 | #endif 47 | /** @endcond */ 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #else 52 | # include 53 | #endif 54 | 55 | typedef enum { 56 | ZIX_STATUS_SUCCESS, 57 | ZIX_STATUS_ERROR, 58 | ZIX_STATUS_NO_MEM, 59 | ZIX_STATUS_NOT_FOUND, 60 | ZIX_STATUS_EXISTS, 61 | ZIX_STATUS_BAD_ARG, 62 | ZIX_STATUS_BAD_PERMS, 63 | } ZixStatus; 64 | 65 | /** 66 | Function for comparing two elements. 67 | */ 68 | typedef int (*ZixComparator)(const void* a, const void* b, void* user_data); 69 | 70 | /** 71 | Function for testing equality of two elements. 72 | */ 73 | typedef bool (*ZixEqualFunc)(const void* a, const void* b); 74 | 75 | /** 76 | Function to destroy an element. 77 | */ 78 | typedef void (*ZixDestroyFunc)(void* ptr); 79 | 80 | /** 81 | @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } /* extern "C" */ 86 | #endif 87 | 88 | #endif /* ZIX_COMMON_H */ 89 | -------------------------------------------------------------------------------- /src/uri_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Robin Gareus 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _uri_map_h 20 | #define _uri_map_h 21 | 22 | #include "lv2/lv2plug.in/ns/ext/urid/urid.h" 23 | 24 | class Lv2UriMap 25 | { 26 | public: 27 | Lv2UriMap () : urimap (NULL) , urimap_len (0) {} 28 | ~Lv2UriMap () { free_uri_map (); } 29 | 30 | static LV2_URID uri_to_id (LV2_URI_Map_Callback_Data callback_data, const char* uri) { 31 | Lv2UriMap* self = (Lv2UriMap*) callback_data; 32 | return self->uri_to_id (uri); 33 | } 34 | 35 | static const char* id_to_uri (LV2_URI_Map_Callback_Data callback_data, LV2_URID urid) { 36 | Lv2UriMap* self = (Lv2UriMap*) callback_data; 37 | return self->id_to_uri (urid); 38 | } 39 | 40 | LV2_URID uri_to_id (const char* uri) { 41 | for (uint32_t i = 0; i < urimap_len; ++i) { 42 | if (!strcmp (urimap[i], uri)) { 43 | //printf("Found mapped URI '%s' -> %d\n", uri, i + 1); 44 | return i + 1; 45 | } 46 | } 47 | //printf("map URI '%s' -> %d\n", uri, urimap_len + 1); 48 | urimap = (char**) realloc (urimap, (urimap_len + 1) * sizeof (char*)); 49 | urimap[urimap_len] = strdup (uri); 50 | return ++urimap_len; 51 | } 52 | 53 | const char* id_to_uri (LV2_URID i) { 54 | assert (i > 0 && i <= urimap_len); 55 | if (i == 0 || i > urimap_len) { 56 | fprintf (stderr, "LV2Host: invalid URID lookup\n"); 57 | return NULL; 58 | } 59 | //printf("lookup URI %d -> '%s'\n", i, urimap[i - 1]); 60 | return urimap[i - 1]; 61 | } 62 | 63 | private: 64 | void free_uri_map () { 65 | for (uint32_t i = 0; i < urimap_len; ++i) { 66 | free (urimap[i]); 67 | } 68 | free (urimap); 69 | urimap = NULL; 70 | urimap_len = 0; 71 | } 72 | 73 | char **urimap; 74 | uint32_t urimap_len; 75 | }; 76 | #endif 77 | -------------------------------------------------------------------------------- /lib/pthreads-w32/semaphore.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: semaphore.c 5 | * 6 | * Purpose: 7 | * Concatenated version of separate modules to allow 8 | * inlining optimisation, which it is assumed can only 9 | * be effective within a single module. 10 | * 11 | * Semaphores aren't actually part of the PThreads standard. 12 | * They are defined by the POSIX Standard: 13 | * 14 | * POSIX 1003.1b-1993 (POSIX.1b) 15 | * 16 | * ------------------------------------------------------------- 17 | * 18 | * -------------------------------------------------------------------------- 19 | * 20 | * Pthreads-win32 - POSIX Threads Library for Win32 21 | * Copyright(C) 1998 John E. Bossom 22 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 23 | * 24 | * Contact Email: rpj@callisto.canberra.edu.au 25 | * 26 | * The current list of contributors is contained 27 | * in the file CONTRIBUTORS included with the source 28 | * code distribution. The list can also be seen at the 29 | * following World Wide Web location: 30 | * http://sources.redhat.com/pthreads-win32/contributors.html 31 | * 32 | * This library is free software; you can redistribute it and/or 33 | * modify it under the terms of the GNU Lesser General Public 34 | * License as published by the Free Software Foundation; either 35 | * version 2 of the License, or (at your option) any later version. 36 | * 37 | * This library is distributed in the hope that it will be useful, 38 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 40 | * Lesser General Public License for more details. 41 | * 42 | * You should have received a copy of the GNU Lesser General Public 43 | * License along with this library in the file COPYING.LIB; 44 | * if not, write to the Free Software Foundation, Inc., 45 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 46 | */ 47 | 48 | #if !defined(NEED_FTIME) 49 | # include 50 | #endif 51 | 52 | #include 53 | 54 | #include "pthread.h" 55 | #include "semaphore.h" 56 | #include "implement.h" 57 | 58 | 59 | #include "sem_init.c" 60 | #include "sem_destroy.c" 61 | #include "sem_trywait.c" 62 | #include "sem_wait.c" 63 | #include "sem_timedwait.c" 64 | #include "sem_post.c" 65 | #include "sem_post_multiple.c" 66 | #include "sem_getvalue.c" 67 | #include "sem_open.c" 68 | #include "sem_close.c" 69 | #include "sem_unlink.c" 70 | -------------------------------------------------------------------------------- /lib/pthreads-w32/context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * context.h 3 | * 4 | * Description: 5 | * POSIX thread macros related to thread cancellation. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #ifndef PTW32_CONTEXT_H 38 | #define PTW32_CONTEXT_H 39 | 40 | #undef PTW32_PROGCTR 41 | 42 | #if defined(_M_IX86) || (defined(_X86_) && !defined(__amd64__)) 43 | #define PTW32_PROGCTR(Context) ((Context).Eip) 44 | #endif 45 | 46 | #if defined (_M_IA64) || defined(_IA64) 47 | #define PTW32_PROGCTR(Context) ((Context).StIIP) 48 | #endif 49 | 50 | #if defined(_MIPS_) || defined(MIPS) 51 | #define PTW32_PROGCTR(Context) ((Context).Fir) 52 | #endif 53 | 54 | #if defined(_ALPHA_) 55 | #define PTW32_PROGCTR(Context) ((Context).Fir) 56 | #endif 57 | 58 | #if defined(_PPC_) 59 | #define PTW32_PROGCTR(Context) ((Context).Iar) 60 | #endif 61 | 62 | #if defined(_AMD64_) || defined(__amd64__) 63 | #define PTW32_PROGCTR(Context) ((Context).Rip) 64 | #endif 65 | 66 | #if defined(_ARM_) || defined(ARM) 67 | #define PTW32_PROGCTR(Context) ((Context).Pc) 68 | #endif 69 | 70 | #if !defined(PTW32_PROGCTR) 71 | #error Module contains CPU-specific code; modify and recompile. 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_spin_trylock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_spin_trylock.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_spin_trylock (pthread_spinlock_t * lock) 43 | { 44 | register pthread_spinlock_t s; 45 | 46 | if (NULL == lock || NULL == *lock) 47 | { 48 | return (EINVAL); 49 | } 50 | 51 | if (*lock == PTHREAD_SPINLOCK_INITIALIZER) 52 | { 53 | int result; 54 | 55 | if ((result = ptw32_spinlock_check_need_init (lock)) != 0) 56 | { 57 | return (result); 58 | } 59 | } 60 | 61 | s = *lock; 62 | 63 | switch ((long) 64 | PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG ((PTW32_INTERLOCKED_LONGPTR) &s->interlock, 65 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED, 66 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_UNLOCKED)) 67 | { 68 | case PTW32_SPIN_UNLOCKED: 69 | return 0; 70 | case PTW32_SPIN_LOCKED: 71 | return EBUSY; 72 | case PTW32_SPIN_USE_MUTEX: 73 | return pthread_mutex_trylock (&(s->u.mutex)); 74 | } 75 | 76 | return EINVAL; 77 | } 78 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_spin_lock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_spin_lock.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_spin_lock (pthread_spinlock_t * lock) 43 | { 44 | register pthread_spinlock_t s; 45 | 46 | if (NULL == lock || NULL == *lock) 47 | { 48 | return (EINVAL); 49 | } 50 | 51 | if (*lock == PTHREAD_SPINLOCK_INITIALIZER) 52 | { 53 | int result; 54 | 55 | if ((result = ptw32_spinlock_check_need_init (lock)) != 0) 56 | { 57 | return (result); 58 | } 59 | } 60 | 61 | s = *lock; 62 | 63 | while ((PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED == 64 | PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG ((PTW32_INTERLOCKED_LONGPTR) &s->interlock, 65 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED, 66 | (PTW32_INTERLOCKED_LONG) PTW32_SPIN_UNLOCKED)) 67 | { 68 | } 69 | 70 | if (s->interlock == PTW32_SPIN_LOCKED) 71 | { 72 | return 0; 73 | } 74 | else if (s->interlock == PTW32_SPIN_USE_MUTEX) 75 | { 76 | return pthread_mutex_lock (&(s->u.mutex)); 77 | } 78 | 79 | return EINVAL; 80 | } 81 | -------------------------------------------------------------------------------- /lib/pthreads-w32/autostatic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * autostatic.c 3 | * 4 | * Description: 5 | * This translation unit implements static auto-init and auto-exit logic. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #if defined(PTW32_STATIC_LIB) 38 | 39 | #if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) 40 | 41 | #include "pthread.h" 42 | #include "implement.h" 43 | 44 | static void on_process_init(void) 45 | { 46 | pthread_win32_process_attach_np (); 47 | } 48 | 49 | static void on_process_exit(void) 50 | { 51 | pthread_win32_thread_detach_np (); 52 | pthread_win32_process_detach_np (); 53 | } 54 | 55 | #if defined(__MINGW64__) || defined(__MINGW32__) 56 | # define attribute_section(a) __attribute__((section(a))) 57 | #elif defined(_MSC_VER) 58 | # define attribute_section(a) __pragma(section(a,long,read)); __declspec(allocate(a)) 59 | #endif 60 | 61 | attribute_section(".ctors") void *gcc_ctor = on_process_init; 62 | attribute_section(".dtors") void *gcc_dtor = on_process_exit; 63 | 64 | attribute_section(".CRT$XCU") void *msc_ctor = on_process_init; 65 | attribute_section(".CRT$XPU") void *msc_dtor = on_process_exit; 66 | 67 | #endif /* defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER) */ 68 | 69 | #endif /* PTW32_STATIC_LIB */ 70 | -------------------------------------------------------------------------------- /src/lv2desc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Robin Gareus 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _lv2desc_h_ 20 | #define _lv2desc_h_ 21 | 22 | #include 23 | 24 | #ifndef UINT32_MAX 25 | # define UINT32_MAX (4294967295U) 26 | #endif 27 | 28 | enum PortType { 29 | CONTROL_IN = 0, 30 | CONTROL_OUT, 31 | AUDIO_IN, 32 | AUDIO_OUT, 33 | MIDI_IN, 34 | MIDI_OUT, 35 | ATOM_IN, 36 | ATOM_OUT 37 | }; 38 | 39 | enum PluginCategory { 40 | LV2_Uncategorized, 41 | LV2_AnalyserPlugin, 42 | LV2_InstrumentPlugin, 43 | LV2_OscillatorPlugin, 44 | LV2_SpatialPlugin, 45 | }; 46 | 47 | struct LV2Port { 48 | enum PortType porttype; 49 | 50 | char *name; 51 | char *symbol; 52 | char *doc; 53 | 54 | float val_default; 55 | float val_min; 56 | float val_max; 57 | float steps; 58 | 59 | bool toggled; 60 | bool integer_step; 61 | bool logarithmic; 62 | bool sr_dependent; 63 | bool enumeration; 64 | bool not_on_gui; 65 | bool not_automatic; 66 | //const char* unit; // or format ? 67 | }; 68 | 69 | typedef struct _RtkLv2Description { 70 | char* dsp_uri; 71 | char* gui_uri; 72 | 73 | uint32_t id; 74 | 75 | char* plugin_name; 76 | char* vendor; 77 | char* bundle_path; 78 | char* dsp_path; 79 | char* gui_path; 80 | 81 | int version_minor; 82 | int version_micro; 83 | 84 | struct LV2Port *ports; 85 | 86 | uint32_t nports_total; 87 | uint32_t nports_audio_in; 88 | uint32_t nports_audio_out; 89 | uint32_t nports_midi_in; 90 | uint32_t nports_midi_out; 91 | uint32_t nports_atom_in; 92 | uint32_t nports_atom_out; 93 | uint32_t nports_ctrl; 94 | uint32_t nports_ctrl_in; 95 | uint32_t nports_ctrl_out; 96 | uint32_t min_atom_bufsiz; 97 | uint32_t latency_ctrl_port; 98 | uint32_t enable_ctrl_port; 99 | 100 | bool send_time_info; 101 | bool has_state_interface; 102 | 103 | PluginCategory category; 104 | } RtkLv2Description; 105 | #endif 106 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_getschedparam.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched_getschedparam.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_getschedparam (pthread_t thread, int *policy, 43 | struct sched_param *param) 44 | { 45 | int result; 46 | 47 | /* Validate the thread id. */ 48 | result = pthread_kill (thread, 0); 49 | if (0 != result) 50 | { 51 | return result; 52 | } 53 | 54 | /* 55 | * Validate the policy and param args. 56 | * Check that a policy constant wasn't passed rather than &policy. 57 | */ 58 | if (policy <= (int *) SCHED_MAX || param == NULL) 59 | { 60 | return EINVAL; 61 | } 62 | 63 | /* Fill out the policy. */ 64 | *policy = SCHED_OTHER; 65 | 66 | /* 67 | * This function must return the priority value set by 68 | * the most recent pthread_setschedparam() or pthread_create() 69 | * for the target thread. It must not return the actual thread 70 | * priority as altered by any system priority adjustments etc. 71 | */ 72 | param->sched_priority = ((ptw32_thread_t *)thread.p)->sched_priority; 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sched_yield.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched_yield.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | sched_yield (void) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * This function indicates that the calling thread is 47 | * willing to give up some time slices to other threads. 48 | * 49 | * PARAMETERS 50 | * N/A 51 | * 52 | * 53 | * DESCRIPTION 54 | * This function indicates that the calling thread is 55 | * willing to give up some time slices to other threads. 56 | * NOTE: Since this is part of POSIX 1003.1b 57 | * (realtime extensions), it is defined as returning 58 | * -1 if an error occurs and sets errno to the actual 59 | * error. 60 | * 61 | * RESULTS 62 | * 0 successfully created semaphore, 63 | * ENOSYS sched_yield not supported, 64 | * 65 | * ------------------------------------------------------ 66 | */ 67 | { 68 | Sleep (0); 69 | 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_attr_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_attr_destroy (pthread_attr_t * attr) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * Destroys a thread attributes object. 47 | * 48 | * PARAMETERS 49 | * attr 50 | * pointer to an instance of pthread_attr_t 51 | * 52 | * 53 | * DESCRIPTION 54 | * Destroys a thread attributes object. 55 | * 56 | * NOTES: 57 | * 1) Does not affect threads created with 'attr'. 58 | * 59 | * RESULTS 60 | * 0 successfully destroyed attr, 61 | * EINVAL 'attr' is invalid. 62 | * 63 | * ------------------------------------------------------ 64 | */ 65 | { 66 | if (ptw32_is_attr (attr) != 0) 67 | { 68 | return EINVAL; 69 | } 70 | 71 | /* 72 | * Set the attribute object to a specific invalid value. 73 | */ 74 | (*attr)->valid = 0; 75 | free (*attr); 76 | *attr = NULL; 77 | 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /lib/pthreads-w32/sched_setscheduler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched_setscheduler.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | sched_setscheduler (pid_t pid, int policy) 43 | { 44 | /* 45 | * Win32 only has one policy which we call SCHED_OTHER. 46 | * However, we try to provide other valid side-effects 47 | * such as EPERM and ESRCH errors. Choosing to check 48 | * for a valid policy last allows us to get the most value out 49 | * of this function. 50 | */ 51 | if (0 != pid) 52 | { 53 | int selfPid = (int) GetCurrentProcessId (); 54 | 55 | if (pid != selfPid) 56 | { 57 | HANDLE h = 58 | OpenProcess (PROCESS_SET_INFORMATION, PTW32_FALSE, (DWORD) pid); 59 | 60 | if (NULL == h) 61 | { 62 | errno = 63 | (GetLastError () == 64 | (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; 65 | return -1; 66 | } 67 | else 68 | CloseHandle(h); 69 | } 70 | } 71 | 72 | if (SCHED_OTHER != policy) 73 | { 74 | errno = ENOSYS; 75 | return -1; 76 | } 77 | 78 | /* 79 | * Don't set anything because there is nothing to set. 80 | * Just return the current (the only possible) value. 81 | */ 82 | return SCHED_OTHER; 83 | } 84 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_equal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_equal.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_equal (pthread_t t1, pthread_t t2) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * This function returns nonzero if t1 and t2 are equal, else 47 | * returns zero 48 | * 49 | * PARAMETERS 50 | * t1, 51 | * t2 52 | * thread IDs 53 | * 54 | * 55 | * DESCRIPTION 56 | * This function returns nonzero if t1 and t2 are equal, else 57 | * returns zero. 58 | * 59 | * RESULTS 60 | * non-zero if t1 and t2 refer to the same thread, 61 | * 0 t1 and t2 do not refer to the same thread 62 | * 63 | * ------------------------------------------------------ 64 | */ 65 | { 66 | int result; 67 | 68 | /* 69 | * We also accept NULL == NULL - treating NULL as a thread 70 | * for this special case, because there is no error that we can return. 71 | */ 72 | result = ( t1.p == t2.p && t1.x == t2.x ); 73 | 74 | return (result); 75 | 76 | } /* pthread_equal */ 77 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_once.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_once.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | pthread_once (pthread_once_t * once_control, void (PTW32_CDECL *init_routine) (void)) 42 | { 43 | if (once_control == NULL || init_routine == NULL) 44 | { 45 | return EINVAL; 46 | } 47 | 48 | if ((PTW32_INTERLOCKED_LONG)PTW32_FALSE == 49 | (PTW32_INTERLOCKED_LONG)PTW32_INTERLOCKED_EXCHANGE_ADD_LONG((PTW32_INTERLOCKED_LONGPTR)&once_control->done, 50 | (PTW32_INTERLOCKED_LONG)0)) /* MBR fence */ 51 | { 52 | ptw32_mcs_local_node_t node; 53 | 54 | ptw32_mcs_lock_acquire((ptw32_mcs_lock_t *)&once_control->lock, &node); 55 | 56 | if (!once_control->done) 57 | { 58 | 59 | #if defined(_MSC_VER) && _MSC_VER < 1400 60 | #pragma inline_depth(0) 61 | #endif 62 | 63 | pthread_cleanup_push(ptw32_mcs_lock_release, &node); 64 | (*init_routine)(); 65 | pthread_cleanup_pop(0); 66 | 67 | #if defined(_MSC_VER) && _MSC_VER < 1400 68 | #pragma inline_depth() 69 | #endif 70 | 71 | once_control->done = PTW32_TRUE; 72 | } 73 | 74 | ptw32_mcs_lock_release(&node); 75 | } 76 | 77 | return 0; 78 | 79 | } /* pthread_once */ 80 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_threadDestroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_threadDestroy.c 3 | * 4 | * Description: 5 | * This translation unit implements routines which are private to 6 | * the implementation and may be used throughout it. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | void 43 | ptw32_threadDestroy (pthread_t thread) 44 | { 45 | ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; 46 | ptw32_thread_t threadCopy; 47 | 48 | if (tp != NULL) 49 | { 50 | /* 51 | * Copy thread state so that the thread can be atomically NULLed. 52 | */ 53 | memcpy (&threadCopy, tp, sizeof (threadCopy)); 54 | 55 | /* 56 | * Thread ID structs are never freed. They're NULLed and reused. 57 | * This also sets the thread to PThreadStateInitial (invalid). 58 | */ 59 | ptw32_threadReusePush (thread); 60 | 61 | /* Now work on the copy. */ 62 | if (threadCopy.cancelEvent != NULL) 63 | { 64 | CloseHandle (threadCopy.cancelEvent); 65 | } 66 | 67 | #if ! (defined(__MINGW64__) || defined(__MINGW32__)) || defined (__MSVCRT__) || defined (__DMC__) 68 | /* 69 | * See documentation for endthread vs endthreadex. 70 | */ 71 | if (threadCopy.threadH != 0) 72 | { 73 | CloseHandle (threadCopy.threadH); 74 | } 75 | #endif 76 | 77 | } 78 | } /* ptw32_threadDestroy */ 79 | 80 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_cond_check_need_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_cond_check_need_init.c 3 | * 4 | * Description: 5 | * This translation unit implements condition variables and their primitives. 6 | * 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | INLINE int 43 | ptw32_cond_check_need_init (pthread_cond_t * cond) 44 | { 45 | int result = 0; 46 | ptw32_mcs_local_node_t node; 47 | 48 | /* 49 | * The following guarded test is specifically for statically 50 | * initialised condition variables (via PTHREAD_OBJECT_INITIALIZER). 51 | */ 52 | ptw32_mcs_lock_acquire(&ptw32_cond_test_init_lock, &node); 53 | 54 | /* 55 | * We got here possibly under race 56 | * conditions. Check again inside the critical section. 57 | * If a static cv has been destroyed, the application can 58 | * re-initialise it only by calling pthread_cond_init() 59 | * explicitly. 60 | */ 61 | if (*cond == PTHREAD_COND_INITIALIZER) 62 | { 63 | result = pthread_cond_init (cond, NULL); 64 | } 65 | else if (*cond == NULL) 66 | { 67 | /* 68 | * The cv has been destroyed while we were waiting to 69 | * initialise it, so the operation that caused the 70 | * auto-initialisation should fail. 71 | */ 72 | result = EINVAL; 73 | } 74 | 75 | ptw32_mcs_lock_release(&node); 76 | 77 | return result; 78 | } 79 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_rwlock_check_need_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_rwlock_check_need_init.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | INLINE int 41 | ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock) 42 | { 43 | int result = 0; 44 | ptw32_mcs_local_node_t node; 45 | 46 | /* 47 | * The following guarded test is specifically for statically 48 | * initialised rwlocks (via PTHREAD_RWLOCK_INITIALIZER). 49 | */ 50 | ptw32_mcs_lock_acquire(&ptw32_rwlock_test_init_lock, &node); 51 | 52 | /* 53 | * We got here possibly under race 54 | * conditions. Check again inside the critical section 55 | * and only initialise if the rwlock is valid (not been destroyed). 56 | * If a static rwlock has been destroyed, the application can 57 | * re-initialise it only by calling pthread_rwlock_init() 58 | * explicitly. 59 | */ 60 | if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) 61 | { 62 | result = pthread_rwlock_init (rwlock, NULL); 63 | } 64 | else if (*rwlock == NULL) 65 | { 66 | /* 67 | * The rwlock has been destroyed while we were waiting to 68 | * initialise it, so the operation that caused the 69 | * auto-initialisation should fail. 70 | */ 71 | result = EINVAL; 72 | } 73 | 74 | ptw32_mcs_lock_release(&node); 75 | 76 | return result; 77 | } 78 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_rwlockattr_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_rwlockattr_init.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | int 43 | pthread_rwlockattr_init (pthread_rwlockattr_t * attr) 44 | /* 45 | * ------------------------------------------------------ 46 | * DOCPUBLIC 47 | * Initializes a rwlock attributes object with default 48 | * attributes. 49 | * 50 | * PARAMETERS 51 | * attr 52 | * pointer to an instance of pthread_rwlockattr_t 53 | * 54 | * 55 | * DESCRIPTION 56 | * Initializes a rwlock attributes object with default 57 | * attributes. 58 | * 59 | * RESULTS 60 | * 0 successfully initialized attr, 61 | * ENOMEM insufficient memory for attr. 62 | * 63 | * ------------------------------------------------------ 64 | */ 65 | { 66 | int result = 0; 67 | pthread_rwlockattr_t rwa; 68 | 69 | rwa = (pthread_rwlockattr_t) calloc (1, sizeof (*rwa)); 70 | 71 | if (rwa == NULL) 72 | { 73 | result = ENOMEM; 74 | } 75 | else 76 | { 77 | rwa->pshared = PTHREAD_PROCESS_PRIVATE; 78 | } 79 | 80 | *attr = rwa; 81 | 82 | return (result); 83 | } /* pthread_rwlockattr_init */ 84 | -------------------------------------------------------------------------------- /lib/pthreads-w32/dll.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dll.c 3 | * 4 | * Description: 5 | * This translation unit implements DLL initialisation. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #if !defined(PTW32_STATIC_LIB) 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | #if defined(_MSC_VER) 43 | /* 44 | * lpvReserved yields an unreferenced formal parameter; 45 | * ignore it 46 | */ 47 | #pragma warning( disable : 4100 ) 48 | #endif 49 | 50 | #if defined(__cplusplus) 51 | /* 52 | * Dear c++: Please don't mangle this name. -thanks 53 | */ 54 | extern "C" 55 | #endif /* __cplusplus */ 56 | BOOL WINAPI 57 | DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) 58 | { 59 | BOOL result = PTW32_TRUE; 60 | 61 | switch (fdwReason) 62 | { 63 | 64 | case DLL_PROCESS_ATTACH: 65 | result = pthread_win32_process_attach_np (); 66 | break; 67 | 68 | case DLL_THREAD_ATTACH: 69 | /* 70 | * A thread is being created 71 | */ 72 | result = pthread_win32_thread_attach_np (); 73 | break; 74 | 75 | case DLL_THREAD_DETACH: 76 | /* 77 | * A thread is exiting cleanly 78 | */ 79 | result = pthread_win32_thread_detach_np (); 80 | break; 81 | 82 | case DLL_PROCESS_DETACH: 83 | (void) pthread_win32_thread_detach_np (); 84 | result = pthread_win32_process_detach_np (); 85 | break; 86 | } 87 | 88 | return (result); 89 | 90 | } /* DllMain */ 91 | 92 | #endif /* PTW32_STATIC_LIB */ 93 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_getprocessors.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_getprocessors.c 3 | * 4 | * Description: 5 | * This translation unit implements routines which are private to 6 | * the implementation and may be used throughout it. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | /* 43 | * ptw32_getprocessors() 44 | * 45 | * Get the number of CPUs available to the process. 46 | * 47 | * If the available number of CPUs is 1 then pthread_spin_lock() 48 | * will block rather than spin if the lock is already owned. 49 | * 50 | * pthread_spin_init() calls this routine when initialising 51 | * a spinlock. If the number of available processors changes 52 | * (after a call to SetProcessAffinityMask()) then only 53 | * newly initialised spinlocks will notice. 54 | */ 55 | int 56 | ptw32_getprocessors (int *count) 57 | { 58 | DWORD_PTR vProcessCPUs; 59 | DWORD_PTR vSystemCPUs; 60 | int result = 0; 61 | 62 | #if defined(NEED_PROCESS_AFFINITY_MASK) 63 | 64 | *count = 1; 65 | 66 | #else 67 | 68 | if (GetProcessAffinityMask (GetCurrentProcess (), 69 | &vProcessCPUs, &vSystemCPUs)) 70 | { 71 | DWORD_PTR bit; 72 | int CPUs = 0; 73 | 74 | for (bit = 1; bit != 0; bit <<= 1) 75 | { 76 | if (vProcessCPUs & bit) 77 | { 78 | CPUs++; 79 | } 80 | } 81 | *count = CPUs; 82 | } 83 | else 84 | { 85 | result = EAGAIN; 86 | } 87 | 88 | #endif 89 | 90 | return (result); 91 | } 92 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/patch/patch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup patch Patch 19 | 20 | Messages for accessing and manipulating properties, see 21 | for details. 22 | 23 | Note the patch extension is purely data, this header merely defines URIs for 24 | convenience. 25 | 26 | @{ 27 | */ 28 | 29 | #ifndef LV2_PATCH_H 30 | #define LV2_PATCH_H 31 | 32 | #define LV2_PATCH_URI "http://lv2plug.in/ns/ext/patch" 33 | #define LV2_PATCH_PREFIX LV2_PATCH_URI "#" 34 | 35 | #define LV2_PATCH__Ack LV2_PATCH_PREFIX "Ack" 36 | #define LV2_PATCH__Delete LV2_PATCH_PREFIX "Delete" 37 | #define LV2_PATCH__Copy LV2_PATCH_PREFIX "Copy" 38 | #define LV2_PATCH__Error LV2_PATCH_PREFIX "Error" 39 | #define LV2_PATCH__Get LV2_PATCH_PREFIX "Get" 40 | #define LV2_PATCH__Message LV2_PATCH_PREFIX "Message" 41 | #define LV2_PATCH__Move LV2_PATCH_PREFIX "Move" 42 | #define LV2_PATCH__Patch LV2_PATCH_PREFIX "Patch" 43 | #define LV2_PATCH__Post LV2_PATCH_PREFIX "Post" 44 | #define LV2_PATCH__Put LV2_PATCH_PREFIX "Put" 45 | #define LV2_PATCH__Request LV2_PATCH_PREFIX "Request" 46 | #define LV2_PATCH__Response LV2_PATCH_PREFIX "Response" 47 | #define LV2_PATCH__Set LV2_PATCH_PREFIX "Set" 48 | #define LV2_PATCH__add LV2_PATCH_PREFIX "add" 49 | #define LV2_PATCH__body LV2_PATCH_PREFIX "body" 50 | #define LV2_PATCH__destination LV2_PATCH_PREFIX "destination" 51 | #define LV2_PATCH__property LV2_PATCH_PREFIX "property" 52 | #define LV2_PATCH__readable LV2_PATCH_PREFIX "readable" 53 | #define LV2_PATCH__remove LV2_PATCH_PREFIX "remove" 54 | #define LV2_PATCH__request LV2_PATCH_PREFIX "request" 55 | #define LV2_PATCH__subject LV2_PATCH_PREFIX "subject" 56 | #define LV2_PATCH__sequenceNumber LV2_PATCH_PREFIX "sequenceNumber" 57 | #define LV2_PATCH__value LV2_PATCH_PREFIX "value" 58 | #define LV2_PATCH__wildcard LV2_PATCH_PREFIX "wildcard" 59 | #define LV2_PATCH__writable LV2_PATCH_PREFIX "writable" 60 | 61 | #endif /* LV2_PATCH_H */ 62 | 63 | /** 64 | @} 65 | */ 66 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_spinlock_check_need_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_spinlock_check_need_init.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | INLINE int 42 | ptw32_spinlock_check_need_init (pthread_spinlock_t * lock) 43 | { 44 | int result = 0; 45 | ptw32_mcs_local_node_t node; 46 | 47 | /* 48 | * The following guarded test is specifically for statically 49 | * initialised spinlocks (via PTHREAD_SPINLOCK_INITIALIZER). 50 | */ 51 | ptw32_mcs_lock_acquire(&ptw32_spinlock_test_init_lock, &node); 52 | 53 | /* 54 | * We got here possibly under race 55 | * conditions. Check again inside the critical section 56 | * and only initialise if the spinlock is valid (not been destroyed). 57 | * If a static spinlock has been destroyed, the application can 58 | * re-initialise it only by calling pthread_spin_init() 59 | * explicitly. 60 | */ 61 | if (*lock == PTHREAD_SPINLOCK_INITIALIZER) 62 | { 63 | result = pthread_spin_init (lock, PTHREAD_PROCESS_PRIVATE); 64 | } 65 | else if (*lock == NULL) 66 | { 67 | /* 68 | * The spinlock has been destroyed while we were waiting to 69 | * initialise it, so the operation that caused the 70 | * auto-initialisation should fail. 71 | */ 72 | result = EINVAL; 73 | } 74 | 75 | ptw32_mcs_lock_release(&node); 76 | 77 | return (result); 78 | } 79 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_mutexattr_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_mutexattr_destroy (pthread_mutexattr_t * attr) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * Destroys a mutex attributes object. The object can 47 | * no longer be used. 48 | * 49 | * PARAMETERS 50 | * attr 51 | * pointer to an instance of pthread_mutexattr_t 52 | * 53 | * 54 | * DESCRIPTION 55 | * Destroys a mutex attributes object. The object can 56 | * no longer be used. 57 | * 58 | * NOTES: 59 | * 1) Does not affect mutexes created using 'attr' 60 | * 61 | * RESULTS 62 | * 0 successfully released attr, 63 | * EINVAL 'attr' is invalid. 64 | * 65 | * ------------------------------------------------------ 66 | */ 67 | { 68 | int result = 0; 69 | 70 | if (attr == NULL || *attr == NULL) 71 | { 72 | result = EINVAL; 73 | } 74 | else 75 | { 76 | pthread_mutexattr_t ma = *attr; 77 | 78 | *attr = NULL; 79 | free (ma); 80 | } 81 | 82 | return (result); 83 | } /* pthread_mutexattr_destroy */ 84 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_barrierattr_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_barrier_attr_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_barrierattr_destroy (pthread_barrierattr_t * attr) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * Destroys a barrier attributes object. The object can 47 | * no longer be used. 48 | * 49 | * PARAMETERS 50 | * attr 51 | * pointer to an instance of pthread_barrierattr_t 52 | * 53 | * 54 | * DESCRIPTION 55 | * Destroys a barrier attributes object. The object can 56 | * no longer be used. 57 | * 58 | * NOTES: 59 | * 1) Does not affect barrieres created using 'attr' 60 | * 61 | * RESULTS 62 | * 0 successfully released attr, 63 | * EINVAL 'attr' is invalid. 64 | * 65 | * ------------------------------------------------------ 66 | */ 67 | { 68 | int result = 0; 69 | 70 | if (attr == NULL || *attr == NULL) 71 | { 72 | result = EINVAL; 73 | } 74 | else 75 | { 76 | pthread_barrierattr_t ba = *attr; 77 | 78 | *attr = NULL; 79 | free (ba); 80 | } 81 | 82 | return (result); 83 | } /* pthread_barrierattr_destroy */ 84 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_rwlock_unlock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_rwlock_unlock.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | int 43 | pthread_rwlock_unlock (pthread_rwlock_t * rwlock) 44 | { 45 | int result, result1; 46 | pthread_rwlock_t rwl; 47 | 48 | if (rwlock == NULL || *rwlock == NULL) 49 | { 50 | return (EINVAL); 51 | } 52 | 53 | if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) 54 | { 55 | /* 56 | * Assume any race condition here is harmless. 57 | */ 58 | return 0; 59 | } 60 | 61 | rwl = *rwlock; 62 | 63 | if (rwl->nMagic != PTW32_RWLOCK_MAGIC) 64 | { 65 | return EINVAL; 66 | } 67 | 68 | if (rwl->nExclusiveAccessCount == 0) 69 | { 70 | if ((result = 71 | pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) 72 | { 73 | return result; 74 | } 75 | 76 | if (++rwl->nCompletedSharedAccessCount == 0) 77 | { 78 | result = pthread_cond_signal (&(rwl->cndSharedAccessCompleted)); 79 | } 80 | 81 | result1 = pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); 82 | } 83 | else 84 | { 85 | rwl->nExclusiveAccessCount--; 86 | 87 | result = pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); 88 | result1 = pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); 89 | 90 | } 91 | 92 | return ((result != 0) ? result : result1); 93 | } 94 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007-2012 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup resize-port Resize Port 19 | 20 | Dynamically sized LV2 port buffers. 21 | 22 | @{ 23 | */ 24 | 25 | #ifndef LV2_RESIZE_PORT_H 26 | #define LV2_RESIZE_PORT_H 27 | 28 | #include 29 | #include 30 | 31 | #define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" 32 | #define LV2_RESIZE_PORT_PREFIX LV2_RESIZE_PORT_URI "#" 33 | 34 | #define LV2_RESIZE_PORT__asLargeAs LV2_RESIZE_PORT_PREFIX "asLargeAs" 35 | #define LV2_RESIZE_PORT__minimumSize LV2_RESIZE_PORT_PREFIX "minimumSize" 36 | #define LV2_RESIZE_PORT__resize LV2_RESIZE_PORT_PREFIX "resize" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #else 41 | # include 42 | #endif 43 | 44 | /** A status code for state functions. */ 45 | typedef enum { 46 | LV2_RESIZE_PORT_SUCCESS = 0, /**< Completed successfully. */ 47 | LV2_RESIZE_PORT_ERR_UNKNOWN = 1, /**< Unknown error. */ 48 | LV2_RESIZE_PORT_ERR_NO_SPACE = 2 /**< Insufficient space. */ 49 | } LV2_Resize_Port_Status; 50 | 51 | typedef void* LV2_Resize_Port_Feature_Data; 52 | 53 | /** Host feature to allow plugins to resize their port buffers. */ 54 | typedef struct { 55 | LV2_Resize_Port_Feature_Data data; 56 | 57 | /** 58 | Resize a port buffer to at least `size` bytes. 59 | 60 | This function MAY return an error, in which case the port buffer was not 61 | resized and the port is still connected to the same location. Plugins 62 | MUST gracefully handle this situation. 63 | 64 | This function is in the audio threading class. 65 | 66 | The host MUST preserve the contents of the port buffer when resizing. 67 | 68 | Plugins MAY resize a port many times in a single run callback. Hosts 69 | SHOULD make this as inexpensive as possible. 70 | */ 71 | LV2_Resize_Port_Status (*resize)(LV2_Resize_Port_Feature_Data data, 72 | uint32_t index, 73 | size_t size); 74 | } LV2_Resize_Port_Resize; 75 | 76 | #ifdef __cplusplus 77 | } /* extern "C" */ 78 | #endif 79 | 80 | #endif /* LV2_RESIZE_PORT_H */ 81 | 82 | /** 83 | @} 84 | */ 85 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_rwlockattr_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_rwlockattr_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | int 43 | pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr) 44 | /* 45 | * ------------------------------------------------------ 46 | * DOCPUBLIC 47 | * Destroys a rwlock attributes object. The object can 48 | * no longer be used. 49 | * 50 | * PARAMETERS 51 | * attr 52 | * pointer to an instance of pthread_rwlockattr_t 53 | * 54 | * 55 | * DESCRIPTION 56 | * Destroys a rwlock attributes object. The object can 57 | * no longer be used. 58 | * 59 | * NOTES: 60 | * 1) Does not affect rwlockss created using 'attr' 61 | * 62 | * RESULTS 63 | * 0 successfully released attr, 64 | * EINVAL 'attr' is invalid. 65 | * 66 | * ------------------------------------------------------ 67 | */ 68 | { 69 | int result = 0; 70 | 71 | if (attr == NULL || *attr == NULL) 72 | { 73 | result = EINVAL; 74 | } 75 | else 76 | { 77 | pthread_rwlockattr_t rwa = *attr; 78 | 79 | *attr = NULL; 80 | free (rwa); 81 | } 82 | 83 | return (result); 84 | } /* pthread_rwlockattr_destroy */ 85 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_barrierattr_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_barrier_attr_init.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_barrierattr_init (pthread_barrierattr_t * attr) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * Initializes a barrier attributes object with default 47 | * attributes. 48 | * 49 | * PARAMETERS 50 | * attr 51 | * pointer to an instance of pthread_barrierattr_t 52 | * 53 | * 54 | * DESCRIPTION 55 | * Initializes a barrier attributes object with default 56 | * attributes. 57 | * 58 | * NOTES: 59 | * 1) Used to define barrier types 60 | * 61 | * RESULTS 62 | * 0 successfully initialized attr, 63 | * ENOMEM insufficient memory for attr. 64 | * 65 | * ------------------------------------------------------ 66 | */ 67 | { 68 | pthread_barrierattr_t ba; 69 | int result = 0; 70 | 71 | ba = (pthread_barrierattr_t) calloc (1, sizeof (*ba)); 72 | 73 | if (ba == NULL) 74 | { 75 | result = ENOMEM; 76 | } 77 | else 78 | { 79 | ba->pshared = PTHREAD_PROCESS_PRIVATE; 80 | } 81 | 82 | *attr = ba; 83 | 84 | return (result); 85 | } /* pthread_barrierattr_init */ 86 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_condattr_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * condvar_attr_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements condition variables and their primitives. 6 | * 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | int 43 | pthread_condattr_destroy (pthread_condattr_t * attr) 44 | /* 45 | * ------------------------------------------------------ 46 | * DOCPUBLIC 47 | * Destroys a condition variable attributes object. 48 | * The object can no longer be used. 49 | * 50 | * PARAMETERS 51 | * attr 52 | * pointer to an instance of pthread_condattr_t 53 | * 54 | * 55 | * DESCRIPTION 56 | * Destroys a condition variable attributes object. 57 | * The object can no longer be used. 58 | * 59 | * NOTES: 60 | * 1) Does not affect condition variables created 61 | * using 'attr' 62 | * 63 | * RESULTS 64 | * 0 successfully released attr, 65 | * EINVAL 'attr' is invalid. 66 | * 67 | * ------------------------------------------------------ 68 | */ 69 | { 70 | int result = 0; 71 | 72 | if (attr == NULL || *attr == NULL) 73 | { 74 | result = EINVAL; 75 | } 76 | else 77 | { 78 | (void) free (*attr); 79 | 80 | *attr = NULL; 81 | result = 0; 82 | } 83 | 84 | return result; 85 | 86 | } /* pthread_condattr_destroy */ 87 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_mutexattr_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_init.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_mutexattr_init (pthread_mutexattr_t * attr) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * Initializes a mutex attributes object with default 47 | * attributes. 48 | * 49 | * PARAMETERS 50 | * attr 51 | * pointer to an instance of pthread_mutexattr_t 52 | * 53 | * 54 | * DESCRIPTION 55 | * Initializes a mutex attributes object with default 56 | * attributes. 57 | * 58 | * NOTES: 59 | * 1) Used to define mutex types 60 | * 61 | * RESULTS 62 | * 0 successfully initialized attr, 63 | * ENOMEM insufficient memory for attr. 64 | * 65 | * ------------------------------------------------------ 66 | */ 67 | { 68 | int result = 0; 69 | pthread_mutexattr_t ma; 70 | 71 | ma = (pthread_mutexattr_t) calloc (1, sizeof (*ma)); 72 | 73 | if (ma == NULL) 74 | { 75 | result = ENOMEM; 76 | } 77 | else 78 | { 79 | ma->pshared = PTHREAD_PROCESS_PRIVATE; 80 | ma->kind = PTHREAD_MUTEX_DEFAULT; 81 | } 82 | 83 | *attr = ma; 84 | 85 | return (result); 86 | } /* pthread_mutexattr_init */ 87 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_getspecific.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getspecific.c 3 | * 4 | * Description: 5 | * POSIX thread functions which implement thread-specific data (TSD). 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | void * 42 | pthread_getspecific (pthread_key_t key) 43 | /* 44 | * ------------------------------------------------------ 45 | * DOCPUBLIC 46 | * This function returns the current value of key in the 47 | * calling thread. If no value has been set for 'key' in 48 | * the thread, NULL is returned. 49 | * 50 | * PARAMETERS 51 | * key 52 | * an instance of pthread_key_t 53 | * 54 | * 55 | * DESCRIPTION 56 | * This function returns the current value of key in the 57 | * calling thread. If no value has been set for 'key' in 58 | * the thread, NULL is returned. 59 | * 60 | * RESULTS 61 | * key value or NULL on failure 62 | * 63 | * ------------------------------------------------------ 64 | */ 65 | { 66 | void * ptr; 67 | 68 | if (key == NULL) 69 | { 70 | ptr = NULL; 71 | } 72 | else 73 | { 74 | int lasterror = GetLastError (); 75 | #if defined(RETAIN_WSALASTERROR) 76 | int lastWSAerror = WSAGetLastError (); 77 | #endif 78 | ptr = TlsGetValue (key->key); 79 | 80 | SetLastError (lasterror); 81 | #if defined(RETAIN_WSALASTERROR) 82 | WSASetLastError (lastWSAerror); 83 | #endif 84 | } 85 | 86 | return ptr; 87 | } 88 | -------------------------------------------------------------------------------- /lib/pthreads-w32/ptw32_new.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_new.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | pthread_t 42 | ptw32_new (void) 43 | { 44 | pthread_t t; 45 | pthread_t nil = {NULL, 0}; 46 | ptw32_thread_t * tp; 47 | 48 | /* 49 | * If there's a reusable pthread_t then use it. 50 | */ 51 | t = ptw32_threadReusePop (); 52 | 53 | if (NULL != t.p) 54 | { 55 | tp = (ptw32_thread_t *) t.p; 56 | } 57 | else 58 | { 59 | /* No reuse threads available */ 60 | tp = (ptw32_thread_t *) calloc (1, sizeof(ptw32_thread_t)); 61 | 62 | if (tp == NULL) 63 | { 64 | return nil; 65 | } 66 | 67 | /* ptHandle.p needs to point to it's parent ptw32_thread_t. */ 68 | t.p = tp->ptHandle.p = tp; 69 | t.x = tp->ptHandle.x = 0; 70 | } 71 | 72 | /* Set default state. */ 73 | tp->seqNumber = ++ptw32_threadSeqNumber; 74 | tp->sched_priority = THREAD_PRIORITY_NORMAL; 75 | tp->detachState = PTHREAD_CREATE_JOINABLE; 76 | tp->cancelState = PTHREAD_CANCEL_ENABLE; 77 | tp->cancelType = PTHREAD_CANCEL_DEFERRED; 78 | tp->stateLock = 0; 79 | tp->threadLock = 0; 80 | tp->robustMxListLock = 0; 81 | tp->robustMxList = NULL; 82 | tp->cancelEvent = CreateEvent (0, (int) PTW32_TRUE, /* manualReset */ 83 | (int) PTW32_FALSE, /* setSignaled */ 84 | NULL); 85 | 86 | if (tp->cancelEvent == NULL) 87 | { 88 | ptw32_threadReusePush (tp->ptHandle); 89 | return nil; 90 | } 91 | 92 | return t; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /lib/pthreads-w32/errno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * errno.c 3 | * 4 | * Description: 5 | * This translation unit implements routines associated with spawning a new 6 | * thread. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #if defined(NEED_ERRNO) 39 | 40 | #include "pthread.h" 41 | #include "implement.h" 42 | 43 | static int reallyBad = ENOMEM; 44 | 45 | /* 46 | * Re-entrant errno. 47 | * 48 | * Each thread has it's own errno variable in pthread_t. 49 | * 50 | * The benefit of using the pthread_t structure 51 | * instead of another TSD key is TSD keys are limited 52 | * on Win32 to 64 per process. Secondly, to implement 53 | * it properly without using pthread_t you'd need 54 | * to dynamically allocate an int on starting the thread 55 | * and store it manually into TLS and then ensure that you free 56 | * it on thread termination. We get all that for free 57 | * by simply storing the errno on the pthread_t structure. 58 | * 59 | * MSVC and Mingw32 already have their own thread-safe errno. 60 | * 61 | * #if defined( _REENTRANT ) || defined( _MT ) 62 | * #define errno *_errno() 63 | * 64 | * int *_errno( void ); 65 | * #else 66 | * extern int errno; 67 | * #endif 68 | * 69 | */ 70 | 71 | int * 72 | _errno (void) 73 | { 74 | pthread_t self; 75 | int *result; 76 | 77 | if ((self = pthread_self ()).p == NULL) 78 | { 79 | /* 80 | * Yikes! unable to allocate a thread! 81 | * Throw an exception? return an error? 82 | */ 83 | result = &reallyBad; 84 | } 85 | else 86 | { 87 | result = (int *)(&self.p->exitStatus); 88 | } 89 | 90 | return (result); 91 | 92 | } /* _errno */ 93 | 94 | #endif /* (NEED_ERRNO) */ 95 | -------------------------------------------------------------------------------- /include/lv2/lv2plug.in/ns/lv2core/lv2_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /** 18 | @defgroup util Utilities 19 | @ingroup lv2core 20 | @{ 21 | */ 22 | 23 | #include 24 | 25 | #include "lv2/lv2plug.in/ns/lv2core/lv2.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #else 30 | # include 31 | #endif 32 | 33 | /** 34 | Return the data for a feature in a features array. 35 | 36 | If the feature is not found, NULL is returned. Note that this function is 37 | only useful for features with data, and can not detect features that are 38 | present but have NULL data. 39 | */ 40 | static inline void* 41 | lv2_features_data(const LV2_Feature*const* features, 42 | const char* const uri) 43 | { 44 | for (const LV2_Feature*const* f = features; *f; ++f) { 45 | if (!strcmp(uri, (*f)->URI)) { 46 | return (*f)->data; 47 | } 48 | } 49 | return NULL; 50 | } 51 | 52 | /** 53 | Query a features array. 54 | 55 | This function allows getting several features in one call, and detect 56 | missing required features, with the same caveat of lv2_features_data(). 57 | 58 | The arguments should be a series of const char* uri, void** data, bool 59 | required, terminated by a NULL URI. The data pointers MUST be initialized 60 | to NULL. For example: 61 | 62 | @code 63 | LV2_URID_Log* log = NULL; 64 | LV2_URID_Map* map = NULL; 65 | const char* missing = lv2_features_query( 66 | features, 67 | LV2_LOG__log, &log, false, 68 | LV2_URID__map, &map, true, 69 | NULL); 70 | @endcode 71 | 72 | @return NULL on success, otherwise the URI of this missing feature. 73 | */ 74 | static inline const char* 75 | lv2_features_query(const LV2_Feature* const* features, ...) 76 | { 77 | va_list args; 78 | va_start(args, features); 79 | 80 | const char* uri = NULL; 81 | while ((uri = va_arg(args, const char*))) { 82 | void** data = va_arg(args, void**); 83 | bool required = va_arg(args, int); 84 | 85 | *data = lv2_features_data(features, uri); 86 | if (required && !*data) { 87 | return uri; 88 | } 89 | } 90 | 91 | return NULL; 92 | } 93 | 94 | #ifdef __cplusplus 95 | } /* extern "C" */ 96 | #endif 97 | 98 | /** 99 | @} 100 | @} 101 | */ 102 | -------------------------------------------------------------------------------- /lib/lilv/pluginclass.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2007-2015 David Robillard 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "lilv_internal.h" 21 | 22 | LilvPluginClass* 23 | lilv_plugin_class_new(LilvWorld* world, 24 | const SordNode* parent_node, 25 | const SordNode* uri, 26 | const char* label) 27 | { 28 | LilvPluginClass* pc = (LilvPluginClass*)malloc(sizeof(LilvPluginClass)); 29 | pc->world = world; 30 | pc->uri = lilv_node_new_from_node(world, uri); 31 | pc->label = lilv_node_new(world, LILV_VALUE_STRING, label); 32 | pc->parent_uri = (parent_node 33 | ? lilv_node_new_from_node(world, parent_node) 34 | : NULL); 35 | return pc; 36 | } 37 | 38 | void 39 | lilv_plugin_class_free(LilvPluginClass* plugin_class) 40 | { 41 | if (!plugin_class) { 42 | return; 43 | } 44 | 45 | lilv_node_free(plugin_class->uri); 46 | lilv_node_free(plugin_class->parent_uri); 47 | lilv_node_free(plugin_class->label); 48 | free(plugin_class); 49 | } 50 | 51 | LILV_API const LilvNode* 52 | lilv_plugin_class_get_parent_uri(const LilvPluginClass* plugin_class) 53 | { 54 | return plugin_class->parent_uri ? plugin_class->parent_uri : NULL; 55 | } 56 | 57 | LILV_API const LilvNode* 58 | lilv_plugin_class_get_uri(const LilvPluginClass* plugin_class) 59 | { 60 | return plugin_class->uri; 61 | } 62 | 63 | LILV_API const LilvNode* 64 | lilv_plugin_class_get_label(const LilvPluginClass* plugin_class) 65 | { 66 | return plugin_class->label; 67 | } 68 | 69 | LILV_API LilvPluginClasses* 70 | lilv_plugin_class_get_children(const LilvPluginClass* plugin_class) 71 | { 72 | // Returned list doesn't own categories 73 | LilvPluginClasses* all = plugin_class->world->plugin_classes; 74 | LilvPluginClasses* result = zix_tree_new(false, lilv_ptr_cmp, NULL, NULL); 75 | 76 | for (ZixTreeIter* i = zix_tree_begin((ZixTree*)all); 77 | i != zix_tree_end((ZixTree*)all); 78 | i = zix_tree_iter_next(i)) { 79 | const LilvPluginClass* c = (LilvPluginClass*)zix_tree_get(i); 80 | const LilvNode* parent = lilv_plugin_class_get_parent_uri(c); 81 | if (parent && lilv_node_equals(lilv_plugin_class_get_uri(plugin_class), 82 | parent)) 83 | zix_tree_insert((ZixTree*)result, (LilvPluginClass*)c, NULL); 84 | } 85 | 86 | return result; 87 | } 88 | -------------------------------------------------------------------------------- /lib/pthreads-w32/pthread_condattr_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_condattr_init.c 3 | * 4 | * Description: 5 | * This translation unit implements condition variables and their primitives. 6 | * 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | int 43 | pthread_condattr_init (pthread_condattr_t * attr) 44 | /* 45 | * ------------------------------------------------------ 46 | * DOCPUBLIC 47 | * Initializes a condition variable attributes object 48 | * with default attributes. 49 | * 50 | * PARAMETERS 51 | * attr 52 | * pointer to an instance of pthread_condattr_t 53 | * 54 | * 55 | * DESCRIPTION 56 | * Initializes a condition variable attributes object 57 | * with default attributes. 58 | * 59 | * NOTES: 60 | * 1) Use to define condition variable types 61 | * 2) It is up to the application to ensure 62 | * that it doesn't re-init an attribute 63 | * without destroying it first. Otherwise 64 | * a memory leak is created. 65 | * 66 | * RESULTS 67 | * 0 successfully initialized attr, 68 | * ENOMEM insufficient memory for attr. 69 | * 70 | * ------------------------------------------------------ 71 | */ 72 | { 73 | pthread_condattr_t attr_result; 74 | int result = 0; 75 | 76 | attr_result = (pthread_condattr_t) calloc (1, sizeof (*attr_result)); 77 | 78 | if (attr_result == NULL) 79 | { 80 | result = ENOMEM; 81 | } 82 | 83 | *attr = attr_result; 84 | 85 | return result; 86 | 87 | } /* pthread_condattr_init */ 88 | --------------------------------------------------------------------------------