[ 
https://issues.apache.org/jira/browse/THRIFT-4468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16336336#comment-16336336
 ] 

Jens Geyer commented on THRIFT-4468:
------------------------------------

I don't see this patch as part of the Thrift library. The entire Console 
construct is basically only a helper that was introduced as part of the initial 
development. Since the model was the C# library, the original author introduced 
that class, very likely to reduce dependencies. The implementation is rather 
raw (read: shitty), and - in the case of the real console it is not safe 
against concurrent accesses. If asked, I would rather throw it out instead of 
polishing it and adding features. We are dealing with RPC here, not with 
providing cool console output stuff.

Long story short: I'm against it. -1

> Make the class TGUIConsole thread-safe
> --------------------------------------
>
>                 Key: THRIFT-4468
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4468
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Delphi - Library
>    Affects Versions: 0.11.0
>            Reporter: Anton Shchyrov
>            Priority: Major
>
> In Delphi all methods that refer to VCL should do it only from main thread. 
> But class TGUIConsole despite the name does not contain any synchronization 
> methods.
> My suggestion is to rename this class to TStringsConsole, make method 
> InternalWrite virtual and make new class TGUIConsole inherits from 
> TStringsConsole
> {{ TGUIConsole = class( TStringsConsole )}}
> {{ protected}}
> {{  procedure InternalWrite(const S: string; bWriteLine: Boolean); override;}}
> {{ end;}}
> {{{ TGUIConsole }}}
> {{procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean);}}
> {{begin}}
> {{  if TThread.CurrentThread.ThreadID <> MainThreadID then begin}}
> {{    TThread.Synchronize(nil, procedure}}
> {{      begin}}
> {{        inherited InternalWrite(S, bWriteLine);}}
> {{      end}}
> {{    );}}
> {{  end else}}
> {{    inherited InternalWrite(S, bWriteLine);}}
> {{end;}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to