search for: pthread_mutex_t

Displaying 20 results from an estimated 226 matches for "pthread_mutex_t".

2010 Jul 22
1
[LLVMdev] How to add a GlobalVariable with type pthread_mutex_t
Hi, How can I add a GlobalVariable with type pthread_mutex_t into one module? Thanks, Guoliang
2011 Mar 07
2
[LLVMdev] matching function call arguments
...entry(2) and exit(2). I will not run into cases involving entry (1+1) or entry (fn return values). I am having trouble trying to compare the arguments of entry and exit in the following scenario. #include<stdio.h> #include<stdlib.h> #include<pthread.h> struct sa { int a; pthread_mutex_t *mutex1; }; struct sa *s; pthread_mutex_t mutex1; int main() { s = (struct sa *)malloc(sizeof(struct sa)); s->mutex1 = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); entry(s->mutex1); s->a++; exit(s->mutex1); return 0; } Thanks in advance, Best, --Hari On...
2011 Mar 07
0
[LLVMdev] matching function call arguments
...nvolving entry (1+1) or > entry (fn return values). I am having trouble trying to compare the > arguments of entry and exit in the following scenario. > > #include<stdio.h> > #include<stdlib.h> > #include<pthread.h> > > struct sa > { >   int a; >   pthread_mutex_t *mutex1; > }; > struct sa *s; > > pthread_mutex_t mutex1; > int main() > { >   s = (struct sa *)malloc(sizeof(struct sa)); >   s->mutex1 = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); > >  entry(s->mutex1); > >   s->a++; > >   exit(s->mu...
2019 Apr 23
1
[RFC: nbdkit PATCH] cleanup: Assert mutex sanity
...s/cleanup.h | 5 ++++- common/utils/cleanup.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/utils/cleanup.h b/common/utils/cleanup.h index e6e6140..0ab9e65 100644 --- a/common/utils/cleanup.h +++ b/common/utils/cleanup.h @@ -43,6 +43,9 @@ extern void cleanup_unlock (pthread_mutex_t **ptr); #define CLEANUP_UNLOCK __attribute__((cleanup (cleanup_unlock))) #define ACQUIRE_LOCK_FOR_CURRENT_SCOPE(mutex) \ CLEANUP_UNLOCK pthread_mutex_t *_lock = mutex; \ - pthread_mutex_lock (_lock) + do { \ + int _r = pthread_mutex_lock (_lock); \ + assert (!_r); \ + } while (0) #e...
2008 May 22
0
[PATCH] stubdom: fix and clean pthread minimal support
...14:28:40 2008 +0100 +++ b/extras/mini-os/include/posix/pthread.h Thu May 22 16:08:29 2008 +0100 @@ -1,18 +1,56 @@ #ifndef _POSIX_PTHREAD_H #define _POSIX_PTHREAD_H +#include <stdlib.h> + /* Let''s be single-threaded for now. */ -typedef void *pthread_key_t; -typedef struct {} pthread_mutex_t, pthread_once_t; +typedef struct { + void *ptr; +} *pthread_key_t; +static inline int pthread_key_create(pthread_key_t *key, void (*destr_function)(void*)) +{ + *key = malloc(sizeof(**key)); + (*key)->ptr = NULL; + return 0; +} +static inline int pthread_setspecific(pthread_key_t key...
2011 Mar 07
0
[LLVMdev] matching function call arguments
Could you be more precise about what you mean by "identical"? Would entry(2) and entry(1+1) be considered equivalent? If the same Value* is passed to entry and exit, then pointer equality (==) will detect that. Reid On Mon, Mar 7, 2011 at 8:08 AM, Hari Pyla <harip at vt.edu> wrote: > Hi, >  I am trying to identify if two functions were called with exactly the same
2011 Mar 07
2
[LLVMdev] matching function call arguments
Hi, I am trying to identify if two functions were called with exactly the same argument. For instance, in the below example, assuming both entry() and exit() functions take a single argument, I would like to know if arg1 in entry() is same as arg1in exit(). int a; struct sa { int b; int c; }; int main () { struct sa s; entry (arg1); ... exit (arg1); return 0; } In
2019 Apr 23
0
[nbdkit PATCH 1/4] cleanup: Move cleanup.c to common
...IT_CLEANUP_H + +#include <pthread.h> + +extern void cleanup_free (void *ptr); +#define CLEANUP_FREE __attribute__((cleanup (cleanup_free))) +extern void cleanup_extents_free (void *ptr); +#define CLEANUP_EXTENTS_FREE __attribute__((cleanup (cleanup_extents_free))) +extern void cleanup_unlock (pthread_mutex_t **ptr); +#define CLEANUP_UNLOCK __attribute__((cleanup (cleanup_unlock))) +#define ACQUIRE_LOCK_FOR_CURRENT_SCOPE(mutex) \ + CLEANUP_UNLOCK pthread_mutex_t *_lock = mutex; \ + pthread_mutex_lock (_lock) + +#endif /* NBDKIT_CLEANUP_H */ diff --git a/server/internal.h b/server/internal.h index 817f...
2011 Nov 11
1
[RFC] kvm tools: Implement multiple VQ for virtio-net
...S 2 -#define VIRTIO_NET_RX_QUEUE 0 -#define VIRTIO_NET_TX_QUEUE 1 +#define VIRTIO_NET_NUM_QUEUES 16 +#define VIRTIO_NET_IS_RX_QUEUE(x) (((x) % 2) == 0) struct net_dev; @@ -49,14 +48,13 @@ struct net_dev { struct virtio_net_config config; u32 features; - pthread_t io_rx_thread; - pthread_mutex_t io_rx_lock; - pthread_cond_t io_rx_cond; - - pthread_t io_tx_thread; - pthread_mutex_t io_tx_lock; - pthread_cond_t io_tx_cond; + pthread_t io_thread[VIRTIO_NET_NUM_QUEUES]; + pthread_mutex_t io_lock[VIRTIO_NET_NUM_QUEUES]; + pthread_cond_t io_cond[VIRTIO_NET_NUM_QUEUES]; + int...
2011 Nov 11
1
[RFC] kvm tools: Implement multiple VQ for virtio-net
...S 2 -#define VIRTIO_NET_RX_QUEUE 0 -#define VIRTIO_NET_TX_QUEUE 1 +#define VIRTIO_NET_NUM_QUEUES 16 +#define VIRTIO_NET_IS_RX_QUEUE(x) (((x) % 2) == 0) struct net_dev; @@ -49,14 +48,13 @@ struct net_dev { struct virtio_net_config config; u32 features; - pthread_t io_rx_thread; - pthread_mutex_t io_rx_lock; - pthread_cond_t io_rx_cond; - - pthread_t io_tx_thread; - pthread_mutex_t io_tx_lock; - pthread_cond_t io_tx_cond; + pthread_t io_thread[VIRTIO_NET_NUM_QUEUES]; + pthread_mutex_t io_lock[VIRTIO_NET_NUM_QUEUES]; + pthread_cond_t io_cond[VIRTIO_NET_NUM_QUEUES]; + int...
2012 Jan 26
1
[PATCH v2] libxl: fix mutex initialization
...diff -r f581bb82fecd -r 259112aee618 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Sat Jan 14 19:04:48 2012 +0100 +++ b/tools/libxl/libxl.c Sat Jan 14 19:04:48 2012 +0100 @@ -26,7 +26,6 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in { libxl_ctx *ctx = NULL; struct stat stat_buf; - const pthread_mutex_t mutex_value = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; int rc; if (version != LIBXL_VERSION) { rc = ERROR_VERSION; goto out; } @@ -40,10 +39,10 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in memset(ctx, 0, sizeof(libxl_ctx)); ctx->lg = lg; - /* This somewhat convoluted app...
2014 Jun 09
2
[LLVMdev] Multi-threading and mutexes in LLVM
...ther similar > tools) detects lock order inversion, i.e. a situation which may potentially > lead to a deadlock. > > Yes, that's what WITNESS does in the FreeBSD kernel. The line after the > one you quoted mentioned the port of this to userspace pthreads. > Did it extend the pthread_mutex_t data structure? > > David > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/8aef7ac0/attachment.html>
2019 May 25
0
[nbdkit PATCH 2/2] nbd: Add shared=true parameter
...action *next; +}; + +/* The per-connection handle */ +struct handle { + /* These fields are read-only once initialized */ + int fd; + int flags; + int64_t size; + bool structured; + bool extents; + pthread_t reader; + + /* Prevents concurrent threads from interleaving writes to server */ + pthread_mutex_t write_lock; + + pthread_mutex_t trans_lock; /* Covers access to all fields below */ + struct transaction *trans; + uint64_t unique; + bool dead; +}; + /* Connect to server via absolute name of Unix socket */ static char *sockname; @@ -73,9 +104,18 @@ static const char *export; /* Number of...
2017 Nov 17
0
[nbdkit PATCH 3/6] connections: Add read/write lock over client I/O
...c/connections.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/connections.c b/src/connections.c index dada9aa..dd43a9a 100644 --- a/src/connections.c +++ b/src/connections.c @@ -62,6 +62,8 @@ /* Connection structure. */ struct connection { pthread_mutex_t request_lock; + pthread_mutex_t read_lock; + pthread_mutex_t write_lock; void *handle; void *crypto_session; @@ -206,6 +208,8 @@ new_connection (int sockin, int sockout) conn->sockin = sockin; conn->sockout = sockout; pthread_mutex_init (&conn->request_lock, NULL); +...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...ILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> + +#include "internal.h" + +static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER; + +void +lock_connection (void) +{ + int thread_model = plugin_thread_model (); + + if (thread_model &l...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...ILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> + +#include "internal.h" + +static pthread_mutex_t connection_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t all_requests_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_rwlock_t unload_prevention_lock = PTHREAD_RWLOCK_INITIALIZER; + +void +lock_connection (void) +{ + int thread_model = plugin_thread_model (); + + if (thread_model &l...
2015 Feb 25
2
[PATCH 2/2] nouveau: Do not add most bo's to the global bo list.
...lock was changed. It does, but it doesn't have to. It's fine if you guys don't want to change it. It may never be a problem with gcc. This is the definition of pthread_mutex_lock() in glibc. There aren't any magic hints that this invalidates memory: extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); THOWNL is attribute((nothrow)). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/nouveau/attachments/20150225/1d46e029/attachment.html>
2017 Nov 17
8
[RFC nbdkit PATCH 0/6] Enable full parallel request handling
I want to make my nbd forwarding plugin fully parallel - but to do that, I first need to make nbdkit itself fully parallel ;) With this series, I was finally able to demonstrate out-of-order responses when using qemu-io (which is great at sending back-to-back requests prior to waiting for responses) coupled with the nbd file plugin (which has a great feature of rdelay and wdelay, to make it
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...c/plugins.c | 53 +++++++++++++++++++++++++++-------------------------- 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/src/connections.c b/src/connections.c index e1ac543..51a9772 100644 --- a/src/connections.c +++ b/src/connections.c @@ -69,10 +69,12 @@ struct connection { pthread_mutex_t write_lock; pthread_mutex_t status_lock; int status; /* 1 for more I/O with client, 0 for shutdown, -1 on error */ - void *handle; void *crypto_session; int nworkers; + void **handles; + size_t nr_handles; + uint64_t exportsize; int readonly; int can_flush; @@ -100,16 +102...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...c/plugins.c | 53 +++++++++++++++++++++++++++-------------------------- 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/src/connections.c b/src/connections.c index 7a4c7bb..e225b5c 100644 --- a/src/connections.c +++ b/src/connections.c @@ -69,10 +69,12 @@ struct connection { pthread_mutex_t write_lock; pthread_mutex_t status_lock; int status; /* 1 for more I/O with client, 0 for shutdown, -1 on error */ - void *handle; void *crypto_session; int nworkers; + void **handles; + size_t nr_handles; + uint64_t exportsize; int readonly; int can_flush; @@ -100,16 +102,...