Problem with CActiveScheduler::Add(this)....
| Fri, 2006-04-21 09:18 | |
|
Hi ,
Now i am using debugger n i have find that my program is creashing when i issue 'CActivescheduler::Add(this)' , at this point it gets crashed. i also want to tell u that i am not starting or doing anything to CActiveScheduler class prior to adding this object on scheduler. Do i need to install n then start my active scheduler bcoz i am assuming that in the deafult thread of any process, active scheduler is already present n it need not to start.Am i doing Right ir not? ![]() ![]() n one thing more i am gettign the following msg in epocwind.oout: Can't load phbksyncsvr.dll Plz Respond immediately. Thanx, Amit. |
|







Forum posts: 982
pirosl
Forum posts: 683
Would be nice to see some code -- without it we all can just guess...
Forum posts: 1246
And please do not write stuff like "Plz respond immediatly". Its rude.
The people here are not paid to answer your questions, its something we do on our own time, because we like to contribute to the developer community. If it is a sensibly written question, and someone knows the answer, you will get a quick response anyway.
If you don't, its either because noone here knows the answer, or noone understands what it is you are asking about.
Forum posts: 982
pirosl
Forum posts: 41
As far as my problem is concerened, i am implementing a dll not a GUI application.
N now i have created a now active scheduler in it, install it n when i issue Start() for it, then thread got hanged, is it waiting for some RunL() to hit...
if yes then it means that i will have to wait there for some RunL() to be hitted.
Bcoz i was assuming that this active scheduler will behave normally as of any GUI application's active scheuler where we keep on adding active objects to the scheduler without caring to start it or anything else... now can any body tell me what is the behaviour of active scheduler which we install on our own..
Thanx & Regards,
Amit.
Forum posts: 982
pirosl
Forum posts: 41
'CActiveScheduler::Start()' is encountered then the thread got hang up....
i am giving some piece of my code below:
void SocketManager::ConstructL()
{
//Creating, installing and starting Active scheduler for itself.
iCurrentScheduler=new (ELeave) CActiveScheduler();
CActiveScheduler::Install(iCurrentScheduler);
//Here after executing instruction below thread is hanging up.
CActiveScheduler::Start();
iResolver=CHostResolver::NewL(this,iSocketServerSession);
}
Above ConstructL() is just called from the constructor of one class inmy static dll whose APIs my application will use.
Thanx,
Amit.
Forum posts: 982
From sdk:
"At least one active object, with an outstanding request, must be added to the scheduler before the wait loop is started, otherwise no events will occur and the thread will hang, or any events that do occur will be counted as stray signals, raising a panic."
pirosl
Forum posts: 41
From sdk:
"At least one active object, with an outstanding request, must be added to the scheduler before the wait loop is started, otherwise no events will occur and the thread will hang, or any events that do occur will be counted as stray signals, raising a panic."
1)it will just create open a session with socket server.
2)it will create instance of another class which socket manager will use for resolving remote domain namesn it is also an active object, i have added in that active scheduler.
3)it will also create reader n writer active objects which i have also added on active scheduler.
thats is all for its creation.
Now if appliation will call my API of this socketmanager class to 'ReadFromSocketAsynchronously()', what do u suggest that should i Start() active scheduler from within this API....
Can u suggest me a solution to cop up with this problem???
Thanx & Regards,
Amit.
Forum posts: 982
The best thing in your case is to add a fake active object to your active scheduler (in the code you presented to us) you'll add an ao which will outstand time requests for example.....in this case you're sure at least one ao with an outstanding request is in your active scheduler....and even if the client will not add any ao the app will still run...
Does this make any sense for you?
pirosl
Forum posts: 41
The best thing in your case is to add a fake active object to your active scheduler (in the code you presented to us) you'll add an ao which will outstand time requests for example.....in this case you're sure at least one ao with an outstanding request is in your active scheduler....and even if the client will not add any ao the app will still run...
Does this make any sense for you?
i am getting ur point but i am not getting u completely.
bcoz what that fake active object will do..
n when i wll issue start() for that fake ao then will it not be my thread be waiting for some RunL() of that fake ao or any other ao(if there is) to hit..
Can u plz give me a piece of code to solve this problem..
Really Thanx buddy,
Amit.
Forum posts: 982
pirosl
Forum posts: 982
Your last post on this link is nice but unfortunatelly will not help him to understand where he missundertands
pirosl
If you are creating a DLL which will be used by an app then you shouldn't be creating and starting an active scheduler within the DLL itself as when the DLL is used by the application there will be one already installed by the UI framework.
If the DLL is being used by something which isn't an app i.e. just an exe, then still you shouldn't add an active scheduler to the DLL, you should add it to the exe.
[Also there should never ever be any need to have a 'fake' active object which is making some arbitary and random request such as a timer request. If any implementation ever has such a thing it has been incorrectly designed.]
Forum posts: 41
Sorry, i was confusing little bit AS with AO, but i am clear abt it that we have to start AS (NOT AO).
But now if we look at the problem, u r suggesting me to Start() AS from within my dll n putting a fake AO on it, but don't u think in this way if i will proceed i will not be able to return the control of program to the appn(or exe) using my dll, control will hung in my Start loop, how will appn(or exe) get control back...
Plz also see reply to thread created by Numpty which u have given me as link.
i have written this in detail, plz have a look at it n also plz see what Guest says at reply no 14.
Regards,
Amit.