This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add pthread_sigqueue(3)


This patchset adds pthread_sigqueue(3), a GNU extension:

http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_sigqueue.3.html

The implementation is based on the existing sigqueue(2) and
pthread_kill(3) code.

Patches for winsup/cygwin and winsup/doc attached.


Yaakov

2012-01-??  Yaakov Selkowitz  <yselkowitz@...>

	* cygwin.din (pthread_sigqueue): Export.
	* posix.sgml (std-gnu): Add pthread_sigqueue.
	* thread.cc (pthread_sigqueue): New function.
	* include/thread.h (pthread_sigqueue): New function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

Index: cygwin.din
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.246
diff -u -p -r1.246 cygwin.din
--- cygwin.din	3 Aug 2011 19:17:02 -0000	1.246
+++ cygwin.din	4 Aug 2011 09:21:52 -0000
@@ -1270,6 +1270,7 @@ pthread_setschedparam SIGFE
 pthread_setschedprio SIGFE
 pthread_setspecific SIGFE
 pthread_sigmask SIGFE
+pthread_sigqueue SIGFE
 pthread_suspend SIGFE
 pthread_spin_destroy SIGFE
 pthread_spin_init SIGFE
Index: posix.sgml
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/posix.sgml,v
retrieving revision 1.70
diff -u -p -r1.70 posix.sgml
--- posix.sgml	3 Aug 2011 19:17:02 -0000	1.70
+++ posix.sgml	4 Aug 2011 09:21:53 -0000
@@ -1133,6 +1133,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008)
     pow10f
     ppoll
     pthread_getattr_np
+    pthread_sigqueue
     ptsname_r
     removexattr
     setxattr
Index: thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.246
diff -u -p -r1.246 thread.cc
--- thread.cc	3 Aug 2011 19:17:02 -0000	1.246
+++ thread.cc	4 Aug 2011 09:21:53 -0000
@@ -3093,6 +3093,24 @@ pthread_sigmask (int operation, const si
   return res;
 }
 
+extern "C" int
+pthread_sigqueue (pthread_t *thread, int sig, const union sigval value)
+{
+  siginfo_t si = {0};
+
+  if (!pthread::is_good_object (thread))
+    return EINVAL;
+  if (!(*thread)->valid)
+    return ESRCH;
+
+  si.si_signo = sig;
+  si.si_code = SI_QUEUE;
+  si.si_value = value;
+  si.si_pid = myself->pid;
+  si.si_uid = myself->uid;
+  return sig_send (NULL, si, (*thread)->cygtls);
+}
+
 /* ID */
 
 extern "C" int
Index: include/pthread.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/pthread.h,v
retrieving revision 1.34
diff -u -p -r1.34 pthread.h
--- include/pthread.h	21 Jul 2011 09:39:22 -0000	1.34
+++ include/pthread.h	4 Aug 2011 09:21:53 -0000
@@ -202,6 +202,7 @@ void pthread_testcancel (void);
 /* Non posix calls */
 
 int pthread_getattr_np (pthread_t, pthread_attr_t *);
+int pthread_sigqueue (pthread_t *, int, const union sigval);
 int pthread_suspend (pthread_t);
 int pthread_continue (pthread_t);
 int pthread_yield (void);
Index: include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.351
diff -u -p -r1.351 version.h
--- include/cygwin/version.h	3 Aug 2011 19:17:02 -0000	1.351
+++ include/cygwin/version.h	4 Aug 2011 09:21:53 -0000
@@ -427,12 +427,13 @@ details. */
       256: Add CW_ALLOC_DRIVE_MAP, CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
       257: Export getpt.
       258: Export get_current_dir_name.
+      259: Export pthread_sigqueue.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 258
+#define CYGWIN_VERSION_API_MINOR 259
 
      /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible
2012-01-??  Yaakov Selkowitz  <yselkowitz@...>

	* new-features.sgml (ov-new1.7.10): Document pthread_sigqueue.

Index: new-features.sgml
===================================================================
RCS file: /cvs/src/src/winsup/doc/new-features.sgml,v
retrieving revision 1.96
diff -u -p -r1.96 new-features.sgml
--- new-features.sgml	1 Jan 2012 18:55:40 -0000	1.96
+++ new-features.sgml	1 Jan 2012 18:56:51 -0000
@@ -103,7 +103,7 @@ dlopen now supports the Glibc-specific R
 <listitem><para>
 Other new API: clock_settime, __fpurge, getgrouplist, get_current_dir_name,
 getpt, ppoll, psiginfo, psignal, ptsname_r, sys_siglist, pthread_setschedprio,
-sysinfo.
+pthread_sigqueue, sysinfo.
 </para></listitem>
 
 </itemizedlist>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]