Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-24 Thread Martin Schreiber
On Tuesday 24 July 2012 10:05:16 IvankoB wrote:
 Strangely but the below code doesn't redraw the label if called from
 OnTerminate
 (checked for sure that the program flow enters this code)
 //---

 begin
 //application.lock;
 try
{выйти из программы по завершении sender.OnExecute}
case RESULTCODETY(ExitCode) of
  SUCCESS: begin
lblFinStatus.caption:= 'Завершено успешно.';
lblFinStatus.color:= cl_ltgreen;
  end;
  CANCELLED: begin
lblFinStatus.caption:= 'Отменено.';
lblFinStatus.color:= cl_ltblue;
  end
  else {FAILED}
lblFinStatus.caption:= 'Произошла ощибка.';
lblFinStatus.color:= cl_ltred;
end;
 finally
 //  application.unlock;
 end;

Application is locked here (onterminate is called in locked state).

 waitus(100);

Mainthread can not run because application is locked.


function tthreadcomp.threadproc(sender: tmsethread): integer;
begin
 fthread:= teventthread(sender);
 try
  if assigned(fonstart) then begin
   application.lock;
   try
    fonstart(self);
   finally
    application.unlock;
   end;
  end;
  if assigned(fonexecute) then begin
   fonexecute(self);
  end;
  if assigned(fonterminate) then begin
   application.lock;
   try
    fonterminate(self);
   finally
    application.unlock;
 --- label redraw applies here

   end;
  end;
  result:= 0;
 finally
  if tco_autorelease in foptions then begin
   release;
  end;
 end;
end;


 //---

 but does it successfully if called at end of OnExecute.

If you want to be refreshed by waitus() in onterminate do

 application.unlock;
 waitus(100);
 application.lock;


Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-24 Thread IvankoB
 How do You debug threaded apps ?

 Open the thread window, select the thread you want to debug. Linux gdb  
 works
 better for debugging threads then the Windows version.
 Sometimes 'Project'-'Options'-'Call GUI_DEBUGBEGIN/GUI_DEBUGEND must be
 activated in order to prevent gdb crashes.


For evil apps it also good to restart GDB after app run :)
( todays' experience )

PS: ExitCode+Terminate work excellent.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread IvankoB

Also TThreadComp.terminate in its OnStarted so that to exit its  
OnExecute  OnTerminated on check if terminated then exit;
(this approach assumes errors revealed in OnStarted which should stop  
further thread running)


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Martin Schreiber
On Monday 23 July 2012 13:41:35 IvankoB wrote:
 Me need to have an application result code.

Probably. There will be an immediate abort of the program without calling 
finalize routines.

Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Ivanko B
Probably. There will be an immediate abort of the program without calling
 finalize routines.

Which checks to perform from the thread for already not existing
widgets of main application so that to eliminate AV etc ?


2012/7/23, Martin Schreiber mse00...@gmail.com:
 On Monday 23 July 2012 13:52:00 IvankoB wrote:
 Also TThreadComp.terminate in its OnStarted so that to exit its
 OnExecute  OnTerminated on check if terminated then exit;
 (this approach assumes errors revealed in OnStarted which should stop
 further thread running)

 It should be.

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 mseide-msegui-talk mailing list
 mseide-msegui-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Martin Schreiber
On Monday 23 July 2012 14:33:54 Ivanko B wrote:
 Probably. There will be an immediate abort of the program without calling
  finalize routines.
 
 Which checks to perform from the thread for already not existing
 widgets of main application so that to eliminate AV etc ?

Probably. Although you should ask FPC if it is safe.

Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread IvankoB
Probably. There will be an immediate abort of the program without calling
 finalize routines.


Unit's finalization is called. But GDB still shows the apllication  
running after halt, is it correct ?


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Martin Schreiber
On Monday 23 July 2012 17:47:33 IvankoB wrote:
 Probably. There will be an immediate abort of the program without calling

  finalize routines.

 Unit's finalization is called. But GDB still shows the apllication
 running after halt, is it correct ?

I don't know.

Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Martin Schreiber
On Monday 23 July 2012 19:52:50 Ivanko B wrote:
 Me mean the HALT(n) call from within a thread but GDB still looks like
 the main app is still running  some more inadequate things after
 that.

Can you step into the halt() call?

 How do You debug threaded apps ?

Open the thread window, select the thread you want to debug. Linux gdb works 
better for debugging threads then the Windows version. 
Sometimes 'Project'-'Options'-'Call GUI_DEBUGBEGIN/GUI_DEBUGEND must be 
activated in order to prevent gdb crashes.

Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Ivanko B
Can you step into the halt() call?
=
Hmm...me don't have actual FPC sources at that machine.


Welcome in multi thread world! :-)
=
Too much new - up to overloading my brain :) Threading, SSL|Crypto,
networking, HTTP, archiving,..

2012/7/23, Martin Schreiber mse00...@gmail.com:
 On Monday 23 July 2012 19:52:50 Ivanko B wrote:
 Me mean the HALT(n) call from within a thread but GDB still looks like
 the main app is still running  some more inadequate things after
 that.

 Can you step into the halt() call?

 How do You debug threaded apps ?

 Open the thread window, select the thread you want to debug. Linux gdb works

 better for debugging threads then the Windows version.
 Sometimes 'Project'-'Options'-'Call GUI_DEBUGBEGIN/GUI_DEBUGEND must be
 activated in order to prevent gdb crashes.

 Martin

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 mseide-msegui-talk mailing list
 mseide-msegui-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Ivanko B
Which are conditions of terminating (finishing) thread ?



2012/7/24, Ivanko B ivankob4m...@gmail.com:
 Set the global
  variable ExitCode and  set application.terminated to true.
 =
 This looks as a solution.

 2012/7/23, Sieghard s_c_...@arcor.de:
 Hallo IvankoB,

 Du schriebst am Mon, 23 Jul 2012 17:02:02 +0500:

 PS: Since me still can't get proper threading mechanics, Me have dead
 lock in my application.

 Did you make sure that all ressources are reserved strictly in the sme
 order everywhere they're used? Requesting ressources in varying order is
 a
 sure method to create deadlocks:

A: request Ra, request Rb
B: request Rb, request Ra

 If the order of processing is A:Ra, B:Rb, then you have it.
 Try it with B reqesting the other way, and see if you can create a
 deadlock
 that way. Then you can proceed to more complex scenarios.  ;-)

 --
 (Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
 nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
 ---
 Mit freundlichen Grüßen, S. Schicktanz
 ---


 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 mseide-msegui-talk mailing list
 mseide-msegui-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] TThreadComp: is it safe to call HALT(rc) in its OnTerminate ?

2012-07-23 Thread Martin Schreiber
On Monday 23 July 2012 22:57:43 Ivanko B wrote:
 Which are conditions of terminating (finishing) thread ?

Exiting onexecute.

Martin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk