Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips > Additional Libraries
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.


Threading library for optimising compiler


Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 02-29-2008, 06:01 PM
Knows the basics
 
Join Date: Jan 2008
Posts: 53
Default

I apologise for my poor descriptions, i'm just bad english-speaker, so i'm trying to write as short as possible messages to make as less as possible mistakes :-) Yes this code works without an errors, but it works from the second-third time... When i press the button for the first time, there is always "no response received" inscription...

Last edited by Elrick : 02-29-2008 at 06:05 PM.
Reply With Quote
  #22 (permalink)  
Old 02-29-2008, 06:13 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Elrick View Post
Yes this code works without an errors,
Good. You need to keep that error trapping in place.

Quote:
but it works from the second-third time... When i press the button for the first time, there is always "no response received" inscription...
That cannot be anything to do with the threading library. More likely it is something in your device IP stack that causes the initial delay. Try increasing your HTTP timeout.
Reply With Quote
  #23 (permalink)  
Old 02-29-2008, 06:28 PM
Knows the basics
 
Join Date: Jan 2008
Posts: 53
Default

omg! I have written timeout 3000 instead of 30000! This is the main error :-) Now all works fine, thank you very much, agraham, for this fantastic library and for you help in answering to my stupid questions :-)
Reply With Quote
  #24 (permalink)  
Old 02-29-2008, 07:16 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Elrick View Post
my stupid questions :-)
No question is a stupid question if the asker really doesn't know the answer to it
Reply With Quote
  #25 (permalink)  
Old 05-28-2008, 11:21 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Source code for dll merging posted in first post.
Reply With Quote
  #26 (permalink)  
Old 06-22-2008, 08:56 PM
Knows the basics
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 71
Default

Hello agraham,

i tested a bit with your threading lib.I just call a sub as a thread, which appears to work fine.But i'm missing some responses from my sub.All my code parts are writing messages in a console.This is used as a status display and also for debugging purposes.The code is just calling a sub, which does log the message to the console control and also to a log file.The "console printing" sub is using a textbox control for the output, which is under the control of the main gui program.

Questions:

- what's wrong here ?
- Can i call a sub from a sub which has been started as a thread or not ?
- if it's ok to call a sub from a threaded sub, can the called sub access the controls of the main gui program ?
- if not, how can i work around this ?



cheers

TWELVE
Reply With Quote
  #27 (permalink)  
Old 06-23-2008, 09:14 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by TWELVE View Post
- what's wrong here ?
I don't know!
Quote:
Can i call a sub from a sub which has been started as a thread or not ?
Yes, there should be no problem unless you also call that Sub from the main program or another thread. Keep thread code strictly segregated from other code.
Quote:
if it's ok to call a sub from a threaded sub, can the called sub access the controls of the main gui program ?
No. Please read carefully the Thread Pitfalls page of the help. Especially the GUI operations section.
Quote:
if not, how can i work around this ?
Use FireThreadEvent or FireDebugEvent to "call" your subs that manipulate GUI controls. They are provided as a safe path to the the GUI thread. You can only safely manipulate GUI controls in the main thread or in these events or Subs called by them. If you need multiple different operations then distinguish them in the event by setting a Global variable in the thread and doing a Select.... Case in the event.
Reply With Quote
  #28 (permalink)  
Old 06-23-2008, 10:44 PM
Knows the basics
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 71
Default

Hi agraham,

thx for your reply.

I read the threading lib manual carefully, also the pitfalls section, but this was only talking about it would be unsafe to manipulate GUI elements, not it would be impossible.So for me it was not clear that i don't even have access to the GUI controls.

I tested with the Thread_ThreadEvent, which worked fineso far.However, i need to rework the code to have it communicating with the GUI.Furthermore the desktop simulation is throwing two error messages per thread call:

Library running in legacy mode.
Start, RunLock and Join are unavailable.

Start
Not available in legacy mode.

That is really impacting me because it renders the desktop emu nearly useless, unless i confirm 2 error boxes every second or so - depending on how often the thread is being called.

What is the reason for these errors ? Has the desktop lib/version only limited functionality ? Is it possible to suppress these error messages..?



kind regards

TWELVE
Reply With Quote
  #29 (permalink)  
Old 06-24-2008, 09:33 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by TWELVE View Post
would be unsafe to manipulate GUI elements, not it would be impossible.
Unsafe means don't do it because bad things can happen!


Quote:
What is the reason for these errors ? Has the desktop lib/version only limited functionality ? Is it possible to suppress these error messages..?
They are not errors. This is explained this in the the "Thread debugging" section of the help. Please re-read it. As the first line says "Threads may only be used in optimised compiled Basic4PPC applications". That section of help documents the differences between optimised and legacy operations and the demo app shows how to ameliorate some of those differences.
Reply With Quote
  #30 (permalink)  
Old 10-15-2008, 03:39 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,700
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Version 1.3 that understands Basic4ppc version 6.50 and later module prefixes now available in the first post of this thread.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Threading Mr_Gee Basic4ppc Wishlist 0 09-23-2008 08:57 PM
formEXdesktop.dll and threading.dll Byak@ Questions & Help Needed 5 08-13-2008 04:05 PM
Parallel Processing / Multi-Threading questions TWELVE Questions & Help Needed 7 04-29-2008 12:40 PM
Error on compile with Optimising TonyGprs Questions & Help Needed 4 01-27-2008 12:15 PM
The Hekkus Library doesn't work when used with the Optimized Compiler Louis Questions & Help Needed 5 12-28-2007 09:06 PM


All times are GMT. The time now is 10:23 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0