bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checkin of glthread/glcond modules


From: Bruno Haible
Subject: Re: checkin of glthread/glcond modules
Date: Sun, 17 Aug 2008 21:01:56 +0200
User-agent: KMail/1.5.4

Yoann Vandoorselaere wrote:
> Here is an updated patch, that fixes several naming issue and implement
> the yield module.

I've added the 'yield' module, again with minor updates:
  - Renamed LIBSCHED to YIELD_LIB (same convention as we use e.g. for 
ROUND_LIBM).
  - In the module description, mention the link requirements.
  - Depend on 'threadlib', not 'lock'.

Bruno


2008-08-17  Yoann Vandoorselaere  <address@hidden>

        New module 'yield'.
        * modules/yield: New file.
        * lib/glthread/yield.h: New file.
        * m4/yield.m4: New file.
        * MODULES.html.sh (Multithreading): Add yield.

*** modules/yield       2008-08-17 17:11:17.000000000 +0200
--- /packages/GNULIB/gnulib-git/modules/yield   2008-08-17 20:54:20.000000000 
+0200
***************
*** 1,12 ****
  Description:
! Sched yield in multithreaded situations.
  
  Files:
  lib/glthread/yield.h
  m4/yield.m4
  
  Depends-on:
! lock
  
  configure.ac:
  gl_YIELD
--- 1,12 ----
  Description:
! Yielding the processor to other threads.
  
  Files:
  lib/glthread/yield.h
  m4/yield.m4
  
  Depends-on:
! threadlib
  
  configure.ac:
  gl_YIELD
***************
*** 17,22 ****
--- 17,26 ----
  Include:
  "glthread/yield.h"
  
+ Link:
+ $(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise
+ $(YIELD_LIB)
+ 
  License:
  LGPLv2+
  
*** lib/glthread/yield.h        2008-08-17 17:11:16.000000000 +0200
--- /packages/GNULIB/gnulib-git/lib/glthread/yield.h    2008-08-17 
20:55:16.000000000 +0200
***************
*** 1,4 ****
! /* Sched Yield in multithreaded situations.
     Copyright (C) 2005-2008 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
--- 1,4 ----
! /* Yielding the processor to other threads and processes.
     Copyright (C) 2005-2008 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 15,20 ****
--- 15,24 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ /* This file contains a primitive for yielding the processor to other threads.
+      extern void gl_thread_yield (void);
+  */
+ 
  #ifndef _GLTHREAD_YIELD_H
  #define _GLTHREAD_YIELD_H
  
***************
*** 32,38 ****
  extern "C" {
  # endif
  
! # define glthread_yield() sched_yield()
  
  #endif
  
--- 36,43 ----
  extern "C" {
  # endif
  
! # define gl_thread_yield() \
!     sched_yield ()
  
  #endif
  
***************
*** 48,54 ****
  extern "C" {
  # endif
  
! # define glthread_yield() pth_yield(NULL)
  
  #endif
  
--- 53,60 ----
  extern "C" {
  # endif
  
! # define gl_thread_yield() \
!     pth_yield (NULL)
  
  #endif
  
***************
*** 60,74 ****
  
  # include <thread.h>
  # include <synch.h>
- # include <stdlib.h>
  
  # ifdef __cplusplus
  extern "C" {
  # endif
  
! # define glthread_yield() thr_yield()
! #endif
  
  
  /* ========================================================================= 
*/
  
--- 66,80 ----
  
  # include <thread.h>
  # include <synch.h>
  
  # ifdef __cplusplus
  extern "C" {
  # endif
  
! # define gl_thread_yield() \
!     thr_yield ()
  
+ #endif
  
  /* ========================================================================= 
*/
  
***************
*** 78,93 ****
  extern "C" {
  # endif
  
! # define glthread_yield() Sleep(0)
  #endif
  
  
  #if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WIN32_THREADS)
  
  /* Provide dummy implementation if threads are not supported.  */
  
! # define glthread_yield() 0
  
  #endif
  
! #endif 
--- 84,104 ----
  extern "C" {
  # endif
  
! # define gl_thread_yield() \
!     Sleep (0)
! 
  #endif
  
+ /* ========================================================================= 
*/
  
  #if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || 
USE_WIN32_THREADS)
  
  /* Provide dummy implementation if threads are not supported.  */
  
! # define gl_thread_yield() 0
  
  #endif
  
! /* ========================================================================= 
*/
! 
! #endif /* _GLTHREAD_YIELD_H */
*** m4/yield.m4 2008-08-17 17:11:17.000000000 +0200
--- /packages/GNULIB/gnulib-git/m4/yield.m4     2008-08-17 20:52:53.000000000 
+0200
***************
*** 1,21 ****
! # glcond.m4 serial 1 (gettext-0.15)
! dnl Copyright (C) 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
  AC_DEFUN([gl_YIELD],
  [
!   AC_REQUIRE([gl_LOCK])
! 
!   dnl Checks for special libraries for the tests/test-tls test.
!   dnl dnl On some systems, sched_yield is in librt, rather than in libpthread.
!   LIBSCHED=
    if test $gl_threads_api = posix; then
      dnl Solaris has sched_yield in librt, not in libpthread or libc.
!     AC_CHECK_LIB(rt, sched_yield, [LIBSCHED=-lrt],
           [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
!           AC_CHECK_LIB(posix4, sched_yield, [LIBSCHED=-lposix4])])
    fi
!   AC_SUBST([LIBSCHED])
  ])
--- 1,19 ----
! # yield.m4 serial 1
! dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
  AC_DEFUN([gl_YIELD],
  [
!   AC_REQUIRE([gl_THREADLIB])
!   dnl On some systems, sched_yield is in librt, rather than in libpthread.
!   YIELD_LIB=
    if test $gl_threads_api = posix; then
      dnl Solaris has sched_yield in librt, not in libpthread or libc.
!     AC_CHECK_LIB(rt, sched_yield, [YIELD_LIB=-lrt],
        [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
!        AC_CHECK_LIB(posix4, sched_yield, [YIELD_LIB=-lposix4])])
    fi
!   AC_SUBST([YIELD_LIB])
  ])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]