[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.13-361-gddbe612
Lennart Poettering
gitmailer-noreply at 0pointer.de
Thu Jan 22 13:50:19 PST 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 7c7133e09ded0f3fc004737be0443eb9c4dae4c8 (commit)
- Log -----------------------------------------------------------------
ddbe612... use pthread_setaffinity_np() only when it is available
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 2 +-
src/tests/rtstutter.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
commit ddbe6126d365a77ed94aee0b961d7cd334ea2a9b
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jan 22 22:50:03 2009 +0100
use pthread_setaffinity_np() only when it is available
diff --git a/configure.ac b/configure.ac
index 9912843..8e926f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -370,7 +370,7 @@ AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([chmod chown clock_gettime getaddrinfo getgrgid_r getgrnam_r \
getpwnam_r getpwuid_r gettimeofday getuid inet_ntop inet_pton mlock nanosleep \
pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
- sigaction sleep sysconf])
+ sigaction sleep sysconf pthread_setaffinity_np])
AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
diff --git a/src/tests/rtstutter.c b/src/tests/rtstutter.c
index fc23d95..d8aff34 100644
--- a/src/tests/rtstutter.c
+++ b/src/tests/rtstutter.c
@@ -43,24 +43,28 @@ static int msec_lower, msec_upper;
static void* work(void *p) PA_GCC_NORETURN;
static void* work(void *p) {
+#ifdef HAVE_PTHREAD_SETAFFINITY_NP
cpu_set_t mask;
+#endif
struct sched_param param;
- pa_log_notice("CPU%i: Created thread.", PA_PTR_TO_INT(p));
+ pa_log_notice("CPU%i: Created thread.", PA_PTR_TO_UINT(p));
memset(¶m, 0, sizeof(param));
param.sched_priority = 12;
pa_assert_se(pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m) == 0);
+#ifdef HAVE_PTHREAD_SETAFFINITY_NP
CPU_ZERO(&mask);
- CPU_SET((size_t) PA_PTR_TO_INT(p), &mask);
+ CPU_SET((size_t) PA_PTR_TO_UINT(p), &mask);
pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
+#endif
for (;;) {
struct timespec now, end;
uint64_t nsec;
- pa_log_notice("CPU%i: Sleeping for 1s", PA_PTR_TO_INT(p));
+ pa_log_notice("CPU%i: Sleeping for 1s", PA_PTR_TO_UINT(p));
sleep(1);
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
@@ -69,7 +73,7 @@ static void* work(void *p) {
(uint64_t) ((((double) rand())*(double)(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
(uint64_t) ((uint64_t) msec_lower*PA_NSEC_PER_MSEC);
- pa_log_notice("CPU%i: Freezing for %ims", PA_PTR_TO_INT(p), (int) (nsec/PA_NSEC_PER_MSEC));
+ pa_log_notice("CPU%i: Freezing for %ims", PA_PTR_TO_UINT(p), (int) (nsec/PA_NSEC_PER_MSEC));
end.tv_sec += (time_t) (nsec / PA_NSEC_PER_SEC);
end.tv_nsec += (long int) (nsec % PA_NSEC_PER_SEC);
@@ -87,7 +91,7 @@ static void* work(void *p) {
}
int main(int argc, char*argv[]) {
- int n;
+ unsigned n;
srand((unsigned) time(NULL));
@@ -109,7 +113,7 @@ int main(int argc, char*argv[]) {
for (n = 1; n < pa_ncpus(); n++) {
pthread_t t;
- pa_assert_se(pthread_create(&t, NULL, work, PA_INT_TO_PTR(n)) == 0);
+ pa_assert_se(pthread_create(&t, NULL, work, PA_UINT_TO_PTR(n)) == 0);
}
work(PA_INT_TO_PTR(0));
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list