unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Incorrect declarations of thread functions on w32
@ 2006-11-27  2:44 Lennart Borgman
  2006-11-27  9:01 ` Jason Rumney
  0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman @ 2006-11-27  2:44 UTC (permalink / raw)


The thread functions should be declared as

DWORD WINAPI ThreadProc(
   LPVOID lpParameter
);

accordning to MS docs. They are not declared that way in Emacs CVS.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  2:44 Incorrect declarations of thread functions on w32 Lennart Borgman
@ 2006-11-27  9:01 ` Jason Rumney
  2006-11-27  9:03   ` Lennart Borgman
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2006-11-27  9:01 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:
> The thread functions should be declared as
Which thread functions are you talking about?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  9:01 ` Jason Rumney
@ 2006-11-27  9:03   ` Lennart Borgman
  2006-11-27  9:05     ` Jason Rumney
  0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman @ 2006-11-27  9:03 UTC (permalink / raw)
  Cc: Emacs Devel

Jason Rumney wrote:
> Lennart Borgman wrote:
>> The thread functions should be declared as
> Which thread functions are you talking about?
> 


The function arguments to CreateThread.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  9:03   ` Lennart Borgman
@ 2006-11-27  9:05     ` Jason Rumney
  2006-11-27  9:16       ` Lennart Borgman
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2006-11-27  9:05 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:
>> Which thread functions are you talking about?
>
> The function arguments to CreateThread.

Please, if you're going to report a bug, give us the details you found, 
don't expect other people to go chasing after some vague detail like this.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  9:05     ` Jason Rumney
@ 2006-11-27  9:16       ` Lennart Borgman
  2006-11-27  9:38         ` Jason Rumney
  0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman @ 2006-11-27  9:16 UTC (permalink / raw)
  Cc: Emacs Devel

Jason Rumney wrote:
> Lennart Borgman wrote:
>>> Which thread functions are you talking about?
>>
>> The function arguments to CreateThread.
> 
> Please, if you're going to report a bug, give us the details you found, 
> don't expect other people to go chasing after some vague detail like this.


I thought I had given enough information when saying this. In the 
message before I told how the declaration should look according to MS. 
w32_msg_worker should have a declaration that looks like

DWORD WINAPI ThreadProc(
   LPVOID lpParameter
);

where ThreadProc should be replaced with w32_msg_worker. The same for 
reader_thread.

Perhaps the declarations boils down to correct declarations under some 
circumstances, but I believe they should be changed since errors that 
bad declarations produce might be very hard to find. (Memory corruption 
etc.)

And

   DWORD w32_msg_worker ();

in w32_term.c is simply wrong.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  9:16       ` Lennart Borgman
@ 2006-11-27  9:38         ` Jason Rumney
  2006-11-27 13:20           ` Lennart Borgman
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2006-11-27  9:38 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:
> I thought I had given enough information when saying this. In the 
> message before I told how the declaration should look according to MS. 
> w32_msg_worker should have a declaration that looks like
>
> DWORD WINAPI ThreadProc(
>   LPVOID lpParameter
> );
>
> where ThreadProc should be replaced with w32_msg_worker. The same for 
> reader_thread.
reader thread already has that signature.

>
> Perhaps the declarations boils down to correct declarations under some 
> circumstances
> , but I believe they should be changed since errors that bad 
> declarations produce might be very hard to find. (Memory corruption etc.)

In the case of reader_thread, it is the correct declaration in all 
circumstances under Win32 (not under Win16, but Emacs does not target 
that platform)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27  9:38         ` Jason Rumney
@ 2006-11-27 13:20           ` Lennart Borgman
  2006-11-27 16:58             ` Jason Rumney
  0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman @ 2006-11-27 13:20 UTC (permalink / raw)
  Cc: Emacs Devel

Jason Rumney wrote:
> Lennart Borgman wrote:
>> I thought I had given enough information when saying this. In the 
>> message before I told how the declaration should look according to MS. 
>> w32_msg_worker should have a declaration that looks like
>>
>> DWORD WINAPI ThreadProc(
>>   LPVOID lpParameter
>> );
>>
>> where ThreadProc should be replaced with w32_msg_worker. The same for 
>> reader_thread.
> reader thread already has that signature.
> 
>>
>> Perhaps the declarations boils down to correct declarations under some 
>> circumstances
>> , but I believe they should be changed since errors that bad 
>> declarations produce might be very hard to find. (Memory corruption etc.)
> 
> In the case of reader_thread, it is the correct declaration in all 
> circumstances under Win32 (not under Win16, but Emacs does not target 
> that platform)

Seems like reader_thread is ok, but would it not be much easier to 
understand if LPVOID was used instead of void* in the argument?

But w32_msg_worker needs some fix. I would suggest using exactly the 
type declarations from above. It makes it much easier to read the code 
if nothing else.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27 13:20           ` Lennart Borgman
@ 2006-11-27 16:58             ` Jason Rumney
  2006-11-27 17:04               ` Lennart Borgman
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2006-11-27 16:58 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:
> Seems like reader_thread is ok, but would it not be much easier to 
> understand if LPVOID was used instead of void* in the argument?
I don't think so. LPVOID is a macro, anyone who is not familiar with the 
definition that Microsoft has given it would have to search for its 
definition.
void * is standard C.

> But w32_msg_worker needs some fix.
It was done this morning.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Incorrect declarations of thread functions on w32
  2006-11-27 16:58             ` Jason Rumney
@ 2006-11-27 17:04               ` Lennart Borgman
  0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman @ 2006-11-27 17:04 UTC (permalink / raw)
  Cc: Emacs Devel

Jason Rumney wrote:
> Lennart Borgman wrote:
>> Seems like reader_thread is ok, but would it not be much easier to 
>> understand if LPVOID was used instead of void* in the argument?
> I don't think so. LPVOID is a macro, anyone who is not familiar with the 
> definition that Microsoft has given it would have to search for its 
> definition.
> void * is standard C.


Maybe write LPVOID to make it easier to compare and add a comment that 
it usually is just void* ?



>> But w32_msg_worker needs some fix.
> It was done this morning.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-11-27 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-27  2:44 Incorrect declarations of thread functions on w32 Lennart Borgman
2006-11-27  9:01 ` Jason Rumney
2006-11-27  9:03   ` Lennart Borgman
2006-11-27  9:05     ` Jason Rumney
2006-11-27  9:16       ` Lennart Borgman
2006-11-27  9:38         ` Jason Rumney
2006-11-27 13:20           ` Lennart Borgman
2006-11-27 16:58             ` Jason Rumney
2006-11-27 17:04               ` Lennart Borgman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).