Eli Zaretskii wrote:
>> Same error on rhel 7.4 if configure with --without-threads --with-modules.
>>
>> Emacs module assertion: Module function called from outside the current
>> Lisp thread
>
> Does this go away if you put
>
> return true;
>
> at the end of in_current_thread, outside of all the #ifdef's?
No.
emacs-module.c:814:42: error: incompatible integer to pointer conversion passing 'sys_thread_t' (aka 'int') to parameter of type 'pthread_t _Nullable'
(aka 'struct _opaque_pthread_t *') [-Werror,-Wint-conversion]
return pthread_equal (pthread_self (), current_thread->thread_id);
^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:340:59: note: passing argument to parameter here
int pthread_equal(pthread_t _Nullable, pthread_t _Nullable);
because if threads are disabled, the thread ID is an int.
The function also doesn't handle the case where neither HAVE_PTHREAD nor WINDOWSNT are defined (but maybe we don't have such platforms).
Maybe systhread.h should have a function
extern sys_thread_t sys_thread_self ();
so emacs-module.c doesn't have to care about the threading implementations.