#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
#define SIGNAL_THREAD_CHECK(signo) \
do { \
- if (!pthread_equal (pthread_self (), main_thread)) \
+ if (!user_thread_p ()) \
{ \
/* POSIX says any thread can receive the signal. On GNU/Linux \
that is not true, but for other systems (FreeBSD at least) \
self->m_specpdl = xmalloc (self->m_specpdl_size
* sizeof (struct specbinding));
self->m_specpdl_ptr = self->m_specpdl;
+ self->pthread_id = pthread_self ();
/* Thread-local assignment. */
current_thread = self;
return result;
}
+/* Is the current an user thread. */
+int
+user_thread_p (void)
+{
+ struct thread_state *it = all_threads;
+ pthread_t self = pthread_self ();
+ do
+ {
+ if (it->pthread_id == self)
+ return 1;
+ }
+ while (it = it->next_thread);
+
+ return 0;
+}
+
+
int
other_threads_p (void)
{
{
pthread_mutex_init (&global_lock, NULL);
pthread_mutex_lock (&global_lock);
+ primary_thread.pthread_id = pthread_self ();
}
void
#define current_buffer (current_thread->m_current_buffer)
struct thread_state *next_thread;
+
+ pthread_t pthread_id;
};
extern __thread struct thread_state *current_thread;
extern pthread_mutex_t global_lock;
extern int other_threads_p P_ ((void));
+
+extern int user_thread_p P_ ((void));