Index: trunk/include/sh_files.h
===================================================================
--- trunk/include/sh_files.h	(revision 368)
+++ trunk/include/sh_files.h	(revision 371)
@@ -46,7 +46,11 @@
 int sh_files_hle_reg (const char * str);
 
-/* Check for new files matching configured glob patterns.
+/* Check for new files/dirs matching configured glob patterns.
  */
 void sh_files_check_globPatterns();
+
+/* Check for new files (only) matching configured glob patterns.
+ */
+void sh_files_check_globFilePatterns();
 
 /* check the setup
Index: trunk/include/sh_inotify.h
===================================================================
--- trunk/include/sh_inotify.h	(revision 368)
+++ trunk/include/sh_inotify.h	(revision 371)
@@ -43,4 +43,5 @@
 			      int * class, unsigned long * check_mask);
 ssize_t sh_inotify_read(char * buffer, size_t count);
+ssize_t sh_inotify_read_timeout(char * buffer, size_t count, int timeout);
 int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save);
 
Index: trunk/include/sh_pthread.h
===================================================================
--- trunk/include/sh_pthread.h	(revision 368)
+++ trunk/include/sh_pthread.h	(revision 371)
@@ -34,6 +34,12 @@
 		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
                 pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
-                pthread_mutex_trylock(&(M));                               \
-		executeStack = 1
+                if (0 == pthread_mutex_trylock(&(M))) {		           \
+		  executeStack = 1
+
+#define SH_MUTEX_TRYLOCK_UNLOCK(M)					   \
+                }                                                          \
+		pthread_cleanup_pop(executeStack);                         \
+                pthread_setcanceltype(oldtype, NULL);                      \
+	} while (0)
 
 #define SH_MUTEX_UNLOCK(M)						   \
