search for: pthread_t

Displaying 20 results from an estimated 163 matches for "pthread_t".

2013 Feb 13
1
vorbis-tools 1.4.0, ogg123 and MinGW
...e wiki page at https://wiki.xiph.org/Vorbis-tools is still pointing to 1.2.0.) I tried compiling with MinGW ( from http://www.mingw.org ). It builds except for the ogg123 program. Even though there's an --enable-threads=win32 for configure, doesn't look like it does anything. On MinGW a pthread_t is defined as a struct not an int: typedef struct { void * p; unsigned int x; } ptw32_handle_t; typedef ptw32_handle_t pthread_t; The configure test to check if pthreads is available is: int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_c...
2011 Nov 11
1
[RFC] kvm tools: Implement multiple VQ for virtio-net
...#define VIRTIO_NET_NUM_QUEUES 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[...
2011 Nov 11
1
[RFC] kvm tools: Implement multiple VQ for virtio-net
...#define VIRTIO_NET_NUM_QUEUES 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[...
2011 Dec 13
1
Thread-safety issues with vbox driver ?
...mOfDefinedDomains(conn); char **names = malloc(count * sizeof(char *)); virConnectListDefinedDomains(conn, names, count); virDomainPtr *doms = malloc(count * sizeof(virDomainPtr)); for (i = 0 ; i < count ; ++i) { doms[i] = virDomainLookupByName(conn, names[i]); } pthread_t *threads = malloc(count * sizeof(pthread_t)); pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); for (i = 0 ; i < count ; ++i) { pthread_create(&threads[i], &attr, create_and_destroy, (void *)doms[i...
2018 Jun 08
4
vanilla build of 7.7p1 release on linux/4.17 fails with gcc8 @ "/usr/bin/ld: unrecognized option '-Wl,-z,retpolineplt'"
On 8 June 2018 at 11:21, PGNet Dev <pgnet.dev at gmail.com> wrote: > fyi > > add'l -- and looks unrelated -- issue > /usr/include/pthread.h:251:12: note: previous declaration of ?pthread_join? was here > extern int pthread_join (pthread_t __th, void **__thread_return); What included pthread.h? That's explicitly not supported by sshd: $ grep THREAD auth-pam.c #ifdef USE_POSIX_THREADS # error "USE_POSIX_THREADS replaced by UNSUPPORTED_POSIX_THREADS_HACK" * Formerly known as USE_POSIX_THREADS, using this is completely...
2018 Jun 08
4
vanilla build of 7.7p1 release on linux/4.17 fails with gcc8 @ "/usr/bin/ld: unrecognized option '-Wl,-z,retpolineplt'"
On 8 June 2018 at 10:52, PGNet Dev <pgnet.dev at gmail.com> wrote: [...] > So, there's a problem for OpenSSH build with spec'ing LD=/usr/bin/ld ? in this particular case, apparently yes. not generally, though. [...] > What's *intended* re: openssh? Support for LD=ld or only =gcc, or undef'd ? Well the intent is you should be able to set CC and LD to whatever you
2009 Apr 01
2
[LLVMdev] adding header files to code
...s to how to introduce header files by a transformation pass and able to use the types defined in the header file in the pass itself. A similar scenario can arise in a parallelizing transformation where one is trying to create threads but this requires inclusion of pthread.h to access the types like pthread_t. etc. -- Kshitiz Garg Graduate Student Department of Computer Science & Engineering IIT Kanpur -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090401/066db204/attachment.html>
2013 Oct 03
2
[LLVMdev] question about -coverage
...shows that coverage slows down by 50x! % cat ~/tmp/coverage_mt.cc #include <pthread.h> __thread int x; __attribute__((noinline)) void foo() { x++; } void *Thread(void *) { for (int i = 0; i < 100000000; i++) foo(); return 0; } int main() { static const int kNumThreads = 16; pthread_t t[kNumThreads]; for (int i = 0; i < kNumThreads; i++) pthread_create(&t[i], 0, Thread, 0); for (int i = 0; i < kNumThreads; i++) pthread_join(t[i], 0); return 0; } % clang -O2 ~/tmp/coverage_mt.cc -lpthread ; time ./a.out TIME: real: 0.284; user: 3.560; system: 0.000 % cla...
2009 May 19
2
About " Error: C stack usage is too close to the limit"
...PROTECT(tmp = mkString("{print(lh)}")); PROTECT(e = R_ParseVector(tmp, 1, &status, R_NilValue)); PrintValue(e); R_tryEval(VECTOR_ELT(e,0), R_GlobalEnv, &hadError); UNPROTECT(2); end_R(); } int main(int argc, char *argv[]){ pthread_t th1; int iret1; iret1 = pthread_create(&th1, NULL, ts_thread,NULL); pthread_join(th1, NULL); printf("Thread 1 return:%d\n", iret1); return 0; } ----------------------------------- 2, My os and compiler is: ----------------------------------- Linux debian...
2009 Nov 18
2
[LLVMdev] lli -force-interpreter complains about external function
...phello.c ======================== #include <pthread.h> #include <stdio.h> #define NUM_THREADS 4 void *PrintHello(void *threadid) { long tid; tid = (long)threadid; printf("Hello from %ld.\n", tid); pthread_exit(NULL); } int main (int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int ret; long t; for(t=0; t<NUM_THREADS; t++){ #ifdef DEBUG printf("creating thread %ld\n", t); #endif ret = pthread_create(&threads[t], NULL, PrintHello, (void *)t); if (ret){ printf("pthread_create ERROR: %d\n",...
2020 Jun 09
2
Implementing a VTable in LLVM
...vm-backend/llvm_ir_codegen/class_codegen.cc#L57:L77 <https://github.com/mukul-rathi/bolt/blob/vtable/src/llvm-backend/llvm_ir_codegen/class_codegen.cc#L57:L77>) that generates the following global Vtable for a class Foo: %_VtableFoo = type { void (%Foo*, i32)* } %Foo = type { %_VtableFoo*, %pthread_t*, i32, i32, i32, i32 } @_VtableFoo = common global %_VtableFoo { void (%Foo*, i32)* @_Foo__setgi } The code for instantiating the table seems to generate the correct IR (create an object, store a pointer to its vtable) - https://github.com/mukul-rathi/bolt/blob/vtable/src/llvm-backend/llvm_ir_cod...
2009 Mar 18
3
[LLVMdev] Status of LLVM's atomic intrinsics
...pthread_cond_wait(&count_threshold_cv, &count_mutex); printf("watch_count(): thread %ld count now = %d Condition signal received.\n", my_id, count); } pthread_mutex_unlock(&count_mutex); pthread_exit(NULL); } int main (int argc, char *argv[]) { int i, rc; pthread_t threads[1+NUM_THREADS]; pthread_attr_t attr; /* Initialize mutex and condition variable objects */ pthread_mutex_init(&count_mutex, NULL); pthread_cond_init (&count_threshold_cv, NULL); /* For portability, explicitly create threads in a joinable state */ pthread_attr_init(&amp...
2019 May 25
0
[nbdkit PATCH 2/2] nbd: Add shared=true parameter
...offset; + uint32_t count; + uint32_t err; + struct nbdkit_extents *extents; + struct transaction *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...
2013 Nov 20
3
[LLVMdev] Curiosity about transform changes under Sanitizers (Was: [PATCH] Disable branch folding with MemorySanitizer)
...: gcc 4.6.3 does this too. ==> if-bench.cc <== #include <pthread.h> #include <unistd.h> extern int foo(int); extern void bar(int); #ifndef N #define N (1UL << 30) #endif void *Thread(void *p) { for (long i = 0; i < N; i++) foo(0); return 0; } int main() { pthread_t t[3]; pthread_create(&t[0], 0, Thread, 0); pthread_create(&t[1], 0, Thread, 0); pthread_create(&t[2], 0, Thread, 0); for (long i = 0; i < N; i++) bar(i); pthread_join(t[0], 0); pthread_join(t[1], 0); pthread_join(t[2], 0); } ==> g.cc <== int g; int foo(int c...
2013 Oct 04
0
[LLVMdev] question about -coverage
...e <pthread.h> > __thread int x; > __attribute__((noinline)) > void foo() { > x++; > } > > void *Thread(void *) { > for (int i = 0; i < 100000000; i++) > foo(); > return 0; > } > > int main() { > static const int kNumThreads = 16; > pthread_t t[kNumThreads]; > for (int i = 0; i < kNumThreads; i++) > pthread_create(&t[i], 0, Thread, 0); > for (int i = 0; i < kNumThreads; i++) > pthread_join(t[i], 0); > return 0; > } > > % clang -O2 ~/tmp/coverage_mt.cc -lpthread ; time ./a.out > TIME: r...
2020 Feb 07
0
[RFC PATCH v7 52/78] KVM: introspection: add KVMI_EVENT_PAUSE_VCPU
...int vcpu_id; @@ -550,7 +556,7 @@ static void *vcpu_worker(void *data) run = vcpu_state(ctx->vm, ctx->vcpu_id); - while (!ctx->stop) { + while (!READ_ONCE(ctx->stop)) { struct ucall uc; vcpu_run(ctx->vm, ctx->vcpu_id); @@ -589,7 +595,7 @@ static void wait_vcpu_worker(pthread_t vcpu_thread) static void stop_vcpu_worker(pthread_t vcpu_thread, struct vcpu_worker_data *data) { - data->stop = true; + WRITE_ONCE(data->stop, true); wait_vcpu_worker(vcpu_thread); } @@ -673,9 +679,47 @@ static void pause_vcpu(struct kvm_vm *vm) -r, kvm_strerror(-r)); }...
2010 May 20
3
Install eventmachine on Debian Lenny
...usr/include/c++/4.3/ostream:45, from /usr/include/c++/4.3/iostream:45, from project.h:29, from files.cpp:20: /usr/include/pthread.h:225: error: expected constructor, destructor, or type conversion before ‘extern’ /usr/include/pthread.h:242: error: ‘pthread_t’ was not declared in this scope /usr/include/pthread.h:242: error: expected primary-expression before ‘void’ /usr/include/pthread.h:242: error: initializer expression list treated as compound expression /usr/include/pthread.h:247: error: ‘pthread_t’ was not declared in this scope /usr/include/pthre...
2009 Nov 18
0
[LLVMdev] lli -force-interpreter complains about external function
...#include <stdio.h> > #define NUM_THREADS 4 > > void *PrintHello(void *threadid) > { > long tid; > tid = (long)threadid; > printf("Hello from %ld.\n", tid); > pthread_exit(NULL); > } > > int main (int argc, char *argv[]) > { > pthread_t threads[NUM_THREADS]; > int ret; > long t; > for(t=0; t<NUM_THREADS; t++){ > #ifdef DEBUG > printf("creating thread %ld\n", t); > #endif > ret = pthread_create(&threads[t], NULL, PrintHello, (void *)t); > if (ret){ > pr...
2020 Feb 07
0
[RFC PATCH v7 75/78] KVM: introspection: add KVMI_EVENT_SINGLESTEP
...--git a/tools/testing/selftests/kvm/x86_64/kvmi_test.c b/tools/testing/selftests/kvm/x86_64/kvmi_test.c index 090cb7acd2ed..cf5edf91197d 100644 --- a/tools/testing/selftests/kvm/x86_64/kvmi_test.c +++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c @@ -738,6 +738,14 @@ static void stop_vcpu_worker(pthread_t vcpu_thread, wait_vcpu_worker(vcpu_thread); } +static int __do_vcpu_command(struct kvm_vm *vm, int cmd_id, + struct kvmi_msg_hdr *req, size_t req_size, + void *rpl, size_t rpl_size) +{ + send_message(cmd_id, req, req_size); + return receive_cmd_reply(req, rpl, rpl_size); +} + st...
2020 Jul 21
0
[PATCH v9 81/84] KVM: introspection: add KVMI_EVENT_SINGLESTEP
...--git a/tools/testing/selftests/kvm/x86_64/kvmi_test.c b/tools/testing/selftests/kvm/x86_64/kvmi_test.c index 0803d7e5af1e..967ea568d93c 100644 --- a/tools/testing/selftests/kvm/x86_64/kvmi_test.c +++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c @@ -829,6 +829,14 @@ static void stop_vcpu_worker(pthread_t vcpu_thread, wait_vcpu_worker(vcpu_thread); } +static int __do_vcpu_command(struct kvm_vm *vm, int cmd_id, + struct kvmi_msg_hdr *req, size_t req_size, + void *rpl, size_t rpl_size) +{ + send_message(cmd_id, req, req_size); + return receive_cmd_reply(req, rpl, rpl_size); +} + st...