]> sourceware.org Git - newlib-cygwin.git/commitdiff
* path.cc (path_conv::check): Use 'strchr' rather than 'strrchr' to find end of
authorChristopher Faylor <me@cgf.cx>
Fri, 26 Mar 2004 20:02:01 +0000 (20:02 +0000)
committerChristopher Faylor <me@cgf.cx>
Fri, 26 Mar 2004 20:02:01 +0000 (20:02 +0000)
string, for efficiency.
* include/cygwin/_types.h: New file.
* include/sys/lock.h: Ditto.
* include/sys/stdio.h: Ditto.
* thread.cc: Include sys/lock.h
(__cygwin_lock_init): New function.
(__cygwin_lock_init_recursive): Ditto.
(__cygwin_lock_fini): Ditto.
(__cygwin_lock_lock): Ditto.
(__cygwin_lock_trylock): Ditto.
(__cygwin_lock_unlock): Ditto.
(pthread::atforkprepare): Lock file pointer before fork.
(pthread::atforkparent): Unlock file pointer after fork.
(pthread::atforkchild): Ditto.

winsup/cygwin/ChangeLog
winsup/cygwin/path.cc
winsup/cygwin/thread.cc

index cfd18bb9a4f57a9d81dcc18a948bc08193de9952..c0f44a17e1158cc8f44384a3f8e807e830e18fa3 100644 (file)
@@ -1,3 +1,24 @@
+2004-03-26  Christopher Faylor  <cgf@redhat.com>
+
+       * path.cc (path_conv::check): Use 'strchr' rather than 'strrchr' to
+       find end of string, for efficiency.
+
+2004-03-26 Thomas Pfaff <tpfaff@gmx.net>
+
+       * include/cygwin/_types.h: New file.
+       * include/sys/lock.h: Ditto.
+       * include/sys/stdio.h: Ditto.
+       * thread.cc: Include sys/lock.h
+       (__cygwin_lock_init): New function.
+       (__cygwin_lock_init_recursive): Ditto.
+       (__cygwin_lock_fini): Ditto.
+       (__cygwin_lock_lock): Ditto.
+       (__cygwin_lock_trylock): Ditto.
+       (__cygwin_lock_unlock): Ditto.
+       (pthread::atforkprepare): Lock file pointer before fork.
+       (pthread::atforkparent): Unlock file pointer after fork.
+       (pthread::atforkchild): Ditto.
+
 2004-03-26  Corinna Vinschen  <corinna@vinschen.de>
 
        * sem.cc (semget): Fix debug string.
index 96fa0628c01e02fc38a2c2a7905ade994fe2f763..7ed2ee77897e542b56f97ec99def4cb08b77f0cc 100644 (file)
@@ -495,7 +495,7 @@ path_conv::check (const char *src, unsigned opt,
       MALLOC_CHECK;
       assert (src);
 
-      char *p = strrchr (src, '\0');
+      char *p = strchr (src, '\0');
       /* Detect if the user was looking for a directory.  We have to strip the
         trailing slash initially and add it back on at the end due to Windows
         brain damage. */
index 9f06c8e3be2d70eddfcff6496d17fbf4bae17893..11a9d06292030ba4de77ae0f9f20e84cab03cd65 100644 (file)
@@ -44,6 +44,10 @@ details. */
 #include <sys/timeb.h>
 #include <exceptions.h>
 #include <sys/fcntl.h>
+#include <sys/lock.h>
+
+extern "C" void __fp_lock_all ();
+extern "C" void __fp_unlock_all ();
 
 extern int threadsafe;
 
@@ -54,6 +58,43 @@ __getreent ()
   return &_my_tls.local_clib;
 }
 
+extern "C" void
+__cygwin_lock_init (_LOCK_T *lock)
+{
+  *lock = _LOCK_T_INITIALIZER;
+}
+
+extern "C" void
+__cygwin_lock_init_recursive (_LOCK_T *lock)
+{
+  *lock = _LOCK_T_RECURSIVE_INITIALIZER;
+}
+
+extern "C" void
+__cygwin_lock_fini (_LOCK_T *lock)
+{
+  pthread_mutex_destroy ((pthread_mutex_t*) lock);
+}
+
+extern "C" void
+__cygwin_lock_lock (_LOCK_T *lock)
+{
+  pthread_mutex_lock ((pthread_mutex_t*) lock);
+}
+
+extern "C" void
+__cygwin_lock_trylock (_LOCK_T *lock)
+{
+  pthread_mutex_trylock ((pthread_mutex_t*) lock);
+}
+
+
+extern "C" void
+__cygwin_lock_unlock (_LOCK_T *lock)
+{
+  pthread_mutex_unlock ((pthread_mutex_t*) lock);
+}
+
 inline LPCRITICAL_SECTION
 ResourceLocks::Lock (int _resid)
 {
@@ -1908,11 +1949,15 @@ pthread::atforkprepare (void)
       cb->cb ();
       cb = cb->next;
     }
+
+  __fp_lock_all ();
 }
 
 void
 pthread::atforkparent (void)
 {
+  __fp_unlock_all ();
+
   callback *cb = MT_INTERFACE->pthread_parent;
   while (cb)
     {
@@ -1926,6 +1971,8 @@ pthread::atforkchild (void)
 {
   MT_INTERFACE->fixup_after_fork ();
 
+  __fp_unlock_all ();
+
   callback *cb = MT_INTERFACE->pthread_child;
   while (cb)
     {
This page took 0.039494 seconds and 5 git commands to generate.