Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-09

WinCE multithreading

11 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zaher Dirkey
to Fabio Luis Girardi
Fabio Luis Girardi wrote 8 lines
Hi! I'm porting a multi-thread project to WinCE. Everything works fine, except when I put a Label (or any window control) on any form and link it with the data coming from any thread. My question is: What's the current state of the WinCE port with threads?

I have multi thread server on WINCE for SYNC my data from the other PC and work fine, also i have example for WebServer work on WINCE also.

Some time my application hang when synchronize to log or access the gui, but i sloved it by reduce info passed to the gui, or
do no pass any object that created by threads or other threads to the main thread.

You can descript your problem to the FPC team when you have it.

Best Regard

Zaher Dirkey

Jonas Maebe
to Fabio Luis Girardi
Fabio Luis Girardi wrote 9 lines
I'm debugging and I have doubt: I'm using records and pointers to records. On WinCE wiki, the use of unaligned only shows with pointers to integer. And with recods, I must do unalinged(myrec^).member or unalinged(myrec^.member)

If the pointer itself is stored at a potentially unaligned address, you need unaligned(myrec). If the record the pointer points to is stored at a potentially unaligned address, you need unaligned(myrec^.member). If both are the case, you need unaligned(unaligned(myrec)^.member)

I'm fairly certain that unaligned(myrec^).member won't do anything.

Jonas

Felipe Monteiro de Carvalho
to Jonas Maebe

But is the unaligned still required? I remember that unaligned access was sure crash in WinCE many years ago, but I vaguely remember someone mentioned that FPC had improved it's support for the compiler figuring out on it's own when something is unaligned. While doing Android development for example, I haven't yet had a single crash due to unaligned access ... and I made no use of this keyword so far.

Felipe Monteiro de Carvalho
Fabio Luis Girardi
to Felipe Monteiro de Carvalho

Yes, the current FPC has this feature. Maybe the problem with WinCE with multithreading is this:

http://bugs.freepascal.org/view.php?id=18756

and not the use or not of Unaligned keyword.

Added with some outdated documentation on Wiki, this cause a little of confusion in the mind of who starts with WinCE with a multi-thread application.

I changed the issue. Testing now to see how it works.

The best regards,

Fabio Luis Girardi
PascalSCADA Project
http://sourceforge.net/projects/pascalscada
http://www.pascalscada.com

Felipe Monteiro de Carvalho
to Fabio Luis Girardi: Hi! I'm porting a multi-thread project to WinCE. Everything works fine, except when I put…
Fabio Luis Girardi wrote
I'm porting a multi-thread project to WinCE. Everything works fine, except when I put a Label (or any window control) on any form and link it with the data coming from any thread. My question is: What's the current state of the WinCE port with threads?

You cannot use the LCL from other threads ... use LCLIntf.SendMessage instead and handle the message in a procedure in your window.

I just commited some more explanations about SendMessage in the docs. Read here:

http://lazarus.svn.sourceforge.net/viewvc/lazarus/trunk/docs/xml/lcl/lclintf.xml?r1=32351&r2=32350&pathrev=32351

Felipe Monteiro de Carvalho
Fabio Luis Girardi
to Felipe Monteiro de Carvalho

Yes, I don't use this. I access the LCL methods via TThread.Synchronize, On my mind, I'm doing this right... Correct me if I'm wrong.

The bug related tells that TThread.Synchronize don't work as expected in WinCE as in others OS's. It has two examples that don't work as expected on WinCE, both with threads and Critical Sections.

The best regards,

Fabio Luis Girardi
PascalSCADA Project
http://sourceforge.net/projects/pascalscada
http://www.pascalscada.com

Fabio Luis Girardi

Hi!

I made some changes for WinCE and want test. How I rebuild only the RTL on windows?

I'm using WinXP, Lazarus 0.9.30.1 with fpc 2.4.4 + cross-arm downloaded from daily snapshots.

The best regards,

Fabio