Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-12-22 23:35:41 +0400
committerChristopher Faylor <me@cgf.cx>2012-12-22 23:35:41 +0400
commit4a84997ae4e5d770c14eb2bba73022ca3d9789e3 (patch)
tree861f91de6b26d4afc0512f87c56355bd5920e923 /winsup/cygwin
parente97256cf70fc1627641f0a10390b61ba904a6fe5 (diff)
* select.h (select_stuff): Remove variable names from parameter declarations.
(select_info): Ditto. (select_record::dump_select_record): Declare new debugging-only function. (select_info): Zero all fields. (select_pipe_info): Ditto. (select_socket_info): Ditto. (select_serial_info): Ditto. (select_mailslot_info): Ditto. * select.cc (select_record::dump_select_record): Define new debugging-only function. (select_stuff::test_and_set): Call dump_select_record when debugging. * thread.cc (pthread_mutex::unlock): Revert setting of tid to NULL since, in this context, it is a number, not a pointer. (pthread_spinlock::unlock): Ditto.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog20
-rw-r--r--winsup/cygwin/select.cc19
-rw-r--r--winsup/cygwin/select.h23
-rw-r--r--winsup/cygwin/thread.cc4
4 files changed, 55 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7a47897ba..ffc0f38b4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,23 @@
+2012-12-22 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * select.h (select_stuff): Remove variable names from parameter
+ declarations.
+ (select_info): Ditto.
+ (select_record::dump_select_record): Declare new debugging-only
+ function.
+ (select_info): Zero all fields.
+ (select_pipe_info): Ditto.
+ (select_socket_info): Ditto.
+ (select_serial_info): Ditto.
+ (select_mailslot_info): Ditto.
+ * select.cc (select_record::dump_select_record): Define new
+ debugging-only function.
+ (select_stuff::test_and_set): Call dump_select_record when debugging.
+
+ * thread.cc (pthread_mutex::unlock): Revert setting of tid to NULL
+ since, in this context, it is a number, not a pointer.
+ (pthread_spinlock::unlock): Ditto.
+
2012-12-21 Christopher Faylor <me.cygwin2012@cgf.cx>
* sigproc.cc (exit_thread): undef ExitThread or suffer recursion.
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index c67471cbc..143e8c4e7 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -286,6 +286,22 @@ select_stuff::~select_stuff ()
destroy ();
}
+#ifdef DEBUGGING
+void
+select_record::dump_select_record ()
+{
+ select_printf ("fd %d, h %p, fh %p, thread_errno %d, windows_handle %p",
+ fd, h, fh, thread_errno, windows_handle);
+ select_printf ("read_ready %d, write_ready %d, except_ready %d",
+ read_ready, write_ready, except_ready);
+ select_printf ("read_selected %d, write_selected %d, except_selected %d, except_on_write %d",
+ read_selected, write_selected, except_selected, except_on_write);
+
+ select_printf ("startup %p, peek %p, verify %p cleanup %p, next %p",
+ startup, peek, verify, cleanup, next);
+}
+#endif /*DEBUGGING*/
+
/* Add a record to the select chain */
bool
select_stuff::test_and_set (int i, fd_set *readfds, fd_set *writefds,
@@ -315,6 +331,9 @@ select_stuff::test_and_set (int i, fd_set *readfds, fd_set *writefds,
if (s->windows_handle)
windows_used = true;
+#ifdef DEBUGGING
+ s->dump_select_record ();
+#endif
return true;
err:
diff --git a/winsup/cygwin/select.h b/winsup/cygwin/select.h
index f9df95d93..5e746768c 100644
--- a/winsup/cygwin/select.h
+++ b/winsup/cygwin/select.h
@@ -22,11 +22,10 @@ struct select_record
bool read_ready, write_ready, except_ready;
bool read_selected, write_selected, except_selected;
bool except_on_write;
- int (*startup) (select_record *me, class select_stuff *stuff);
+ int (*startup) (select_record *, class select_stuff *);
int (*peek) (select_record *, bool);
- int (*verify) (select_record *me, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds);
- void (*cleanup) (select_record *me, class select_stuff *stuff);
+ int (*verify) (select_record *, fd_set *, fd_set *, fd_set *);
+ void (*cleanup) (select_record *, class select_stuff *);
struct select_record *next;
void set_select_errno () {__seterrno (); thread_errno = errno;}
int saw_error () {return thread_errno;}
@@ -37,6 +36,9 @@ struct select_record
except_selected (false), except_on_write (false),
startup (NULL), peek (NULL), verify (NULL), cleanup (NULL),
next (NULL) {}
+#ifdef DEBUGGING
+ void dump_select_record ();
+#endif
};
struct select_info
@@ -44,11 +46,12 @@ struct select_info
cygthread *thread;
bool stop_thread;
select_record *start;
- select_info () {}
+ select_info (): thread (NULL), stop_thread (0), start (NULL) {}
};
struct select_pipe_info: public select_info
{
+ select_pipe_info (): select_info () {}
};
struct select_socket_info: public select_info
@@ -56,14 +59,17 @@ struct select_socket_info: public select_info
int num_w4;
LONG *ser_num;
HANDLE *w4;
+ select_socket_info (): select_info (), num_w4 (0), ser_num (0), w4 (NULL) {}
};
struct select_serial_info: public select_info
{
+ select_serial_info (): select_info () {}
};
struct select_mailslot_info: public select_info
{
+ select_mailslot_info (): select_info () {}
};
class select_stuff
@@ -88,10 +94,9 @@ public:
select_serial_info *device_specific_serial;
select_mailslot_info *device_specific_mailslot;
- bool test_and_set (int i, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds);
- int poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
- wait_states wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms);
+ bool test_and_set (int, fd_set *, fd_set *, fd_set *);
+ int poll (fd_set *, fd_set *, fd_set *);
+ wait_states wait (fd_set *, fd_set *, fd_set *, DWORD);
void cleanup ();
void destroy ();
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 187ea52fd..ba3221cc9 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -1778,7 +1778,7 @@ pthread_mutex::unlock ()
{
owner = (pthread_t) _unlocked_mutex;
#ifdef DEBUGGING
- tid = NULL;
+ tid = 0; // thread-id
#endif
if (InterlockedDecrement ((long *) &lock_counter))
::SetEvent (win32_obj_id); // Another thread is waiting
@@ -1905,7 +1905,7 @@ pthread_spinlock::unlock ()
{
owner = (pthread_t) _unlocked_mutex;
#ifdef DEBUGGING
- tid = NULL;
+ tid = 0; // thread-id
#endif
InterlockedExchange ((long *) &lock_counter, 0);
::SetEvent (win32_obj_id);