global interpreter lock not working as it should

anton wilson anton.wilson at camotion.com
Fri Aug 2 16:45:31 CEST 2002


On Friday 02 August 2002 04:22 am, Michael Hudson wrote:
> anton wilson <anton.wilson at camotion.com> writes:
> > Ok, I believe that you are right. Taking hints from Tim Peters I
> > checked to see when Linux delivers signals.
>
> Oh, you're using threads *and* signals?  Be prepared for things to
> make no sense whatsoever.


In the linuxthread glibc library, a pthread_cond_wait uses
this code to wait on a condition:



  sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */
  sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */
  THREAD_SETMEM(self, p_signal, 0);
  do {
    sigsuspend(&mask);                   /* Wait for signal */
  } while (THREAD_GETMEM(self, p_signal) !=__pthread_sig_restart);


sigsuspend actually is just a system call that uses this code to wait on a 
condition:



        while (1) {
                current->state = TASK_INTERRUPTIBLE;
                schedule();
                if (do_signal(regs, &saveset))
                        return -EINTR;
        }


Therefore, I am not using signals to wait on a condition, the platform 
however is.







More information about the Python-list mailing list