×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    33

    RProcess creation

    In my program, I would like to create two threads, each running in a different process. My program is in a single exe. I can create two threads in the same process with no trouble, using RThread.Create() and passing in the different thread functions. The RProcess.Create() requires that I load my code from a DLL or EXE on the file system.

    Does anybody know how I can create a thread from within my exe that runs in its own process...seperate from the exe... without having to create another exe to support it?

    May seem like a strange question :-) .. oh BTW, I am using Series 60 SDK with FP1.

    Thanks

  2. #2
    Regular Contributor
    Join Date
    Aug 2004
    Location
    Hyderabad-India
    Posts
    160

    have a look at EOwnerThread

    hi,

    I dont know whether iam answering your question or not....

    There are many ways in creating threads,you can see them here
    http://www.cs.tut.fi/~mobo/Symbianv6...3aCreate%28%29

    to create a thread...

    TInt Create(const TDesC& aName,TThreadFunction aFunction,TInt aStackSize,TAny* aPtr,RLibrary* aLibrary,RProcess* aProcess,RHeap* aHeap, TInt aHeapMinSize,TInt aHeapMaxSize,TOwnerType aType);


    By default, ownership of this thread handle is vested in the current process, but can be vested in the current thread by passing EOwnerThread as the second parameter to this function.

    Here parameter TOwnerType aType .....is an enumeration whose enumerators define the ownership of this thread handle. If not explicitly specified, EOwnerProcess is taken as default.

    Have a look at changing the owner of the thread;so,one process cant interrupt other thread(with different process owner).

    bye

    --
    VVS.Naresh
    http://students.iiit.net/~satyanaresh
    --

  3. #3
    Registered User
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    33
    VVS.Naresh,

    Thanks for your response. I had looked at the SDK docs... the issue that I was running into was that if I use EOwnerProcess, I can create a thread that is owned by the process...if I use EOwnerThread, then the thread is owned by the thread that created it... what I wanted was to create a thread that would be owned by a new process...different from the one that I am currently running in... do you know if this is possible?

    What I am really trying to do is create a sort of watchdog thread/process that will restart a server if the server terminates. I was thinking that they both should be in different processes so as to protect the watchdog should the server process terminate... maybe this is not so important... so.. if I created an EOwnerProcess watchdog thread and an EOwnerProcess server thread... would the watchdog continue to execute if the server thread died for some reason?

    Thanks so much for your help.

  4. #4
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Hi erneykm,
    You can create the two threads in a single process and start the server thread from the other thread if it terminates. I haven't tested this and just giving an idea and let me know if it works or if u have implemented it in anyother way.

    BR,

  5. #5
    Registered User
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    33
    tripiri,

    Thanks for the idea. I have implemented it as you suggest. I created a process loaded from one exe and created two process owned threads. One thread is the watchdog and the other one is the server. The watchdog runs an AO that waits for notification of thread death and restarts another thread if it dies.

    So far it works really well. I am currently looking at what memory protection is provided... it was my understanding that threads in the same process can scribble on eachothers memory... which could potentially cause my server to cause an exception in the watchdog thread... this I did not want, but may be okay.

    Any ideas on how to protect the memory of one thread from another in the same process?

    Thanks for you ideas,

    Ken

  6. #6
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678
    At least with public API, your only (safest) option is providing an exe. There's no way(that I know) to create a separated process but from a file.

  7. #7
    Registered User
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    33
    PushL ... thanks for the feedback. Do you know of a non-public API that would allow this....meaning that if I had access to a devkit would using a non-public api be supported on a given production device? Can you think of an area that I should examine?

  8. #8
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678
    I pressume the best way is asking Symbian or Nokia about this issues. Certainly you'd need to have some certainty before disbursing that money on a devkit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×