emacs-devel
[Top][All Lists]
Advanced

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

Re: the state of the concurrency branch


From: Eli Zaretskii
Subject: Re: the state of the concurrency branch
Date: Wed, 28 Aug 2013 18:58:20 +0300

> Date: Mon, 26 Aug 2013 21:51:41 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> 
> I fixed the compilation, but the stuff in process.c needs work: if you
> invoke "M-x grep", Emacs aborts after Grep exits, here:
> 
>   void
>   delete_read_fd (int fd)
>   {
>     eassert (fd < MAXDESC);
>     eassert (fd <= max_desc); <<<<<<<<<<<<<<<<<
> 
> because max_desc is zero.

Here's some more info about this problem.  The assertion is violated
by the following series of calls:

  delete_read_fd (5);
  recompute_max_desc ();
  delete_read_fd (5);

The old code was doing FD_CLR instead of delete_read_fd, so it was
clearing twice the same bit, which doesn't hurt anything.  The new
code triggers the assertion, because clearing the flag bits in the
first delete_read_fd call causes recompute_max_desc to set max_desc to
zero, and the second call to delete_read_fd aborts.

If I remove the offending assertion, as in the patch below, the
problem goes away.

Why do we need these assertions?

=== modified file 'src/process.c'
--- src/process.c       2013-08-26 18:42:11 +0000
+++ src/process.c       2013-08-28 15:57:15 +0000
@@ -497,7 +497,6 @@ void
 delete_read_fd (int fd)
 {
   eassert (fd < MAXDESC);
-  eassert (fd <= max_desc);
   delete_keyboard_wait_descriptor (fd);
 
   if (fd_callback_info[fd].flags == 0)
@@ -559,7 +558,6 @@ delete_write_fd (int fd)
   int lim = max_desc;
 
   eassert (fd < MAXDESC);
-  eassert (fd <= max_desc);
 
 #ifdef NON_BLOCKING_CONNECT
   if ((fd_callback_info[fd].flags & NON_BLOCKING_CONNECT_FD) != 0)
@@ -6942,7 +6940,6 @@ delete_keyboard_wait_descriptor (int des
   int lim = max_desc;
 
   eassert (desc >= 0 && desc < MAXDESC);
-  eassert (desc <= max_desc);
 
   fd_callback_info[desc].flags &= ~(FOR_READ | KEYBOARD_FD | PROCESS_FD);
 




reply via email to

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