How to set Pocket outlook thread safe

n my application there are three thread runing.I have assign Name to all of them.Let Say Name are
A
B[launches after each 1 minute]
C
Now in one of the method of thread A I modify pocket outlook.While suddenly thread B launches and start doing some modifiaction in outlook.And then my application crashes
Most of time it happend when I am doing something with tasks
How canI work around this problem.



Answer this question

How to set Pocket outlook thread safe

  • mfewtrell

    You will have to do some thread syncronization as suggested. Take a look at using lock() or System.Threading.Monitor class.

  • LOTG

    Both Threads call my VC++ method exposed via DLLimport.While I am runing in thread A method [which works with pocket outlook] the another thread B is start runing [as there is some time interval on which it have to run].Second thread also make call to my VC++ DLL method. [My application crashes here]

    I have Assign name to the threads.What I want's to do is to have a check the method of thread A that while it is runing thread B can't be call.

    What Can I do

    Also I have't used thread monitor prior to this.So little bit explain how it will be beneficial in my case



  • http200

    Kamii47 wrote:
    n my application there are three thread runing.I have assign Name to all of them.Let Say Name are
    A
    B[launches after each 1 minute]
    C
    Now in one of the method of thread A I modify pocket outlook.While suddenly thread B launches and start doing some modifiaction in outlook.And then my application crashes
    Most of time it happend when I am doing something with tasks
    How canI work around this problem.

    I don't think you can force outlook to be thread-safe, but I could be wrong ...

    A better bet might be to synchronize your code, provide a locking mechanism, and only have a thread running to outlook when it's considered safe within the context of your application ...


  • Jassim Rahma

    Kamii47 wrote:

    Both Threads call my VC++ method exposed via DLLimport.While I am runing in thread A method [which works with pocket outlook] the another thread B is start runing [as there is some time interval on which it have to run].Second thread also make call to my VC++ DLL method. [My application crashes here]

    I have Assign name to the threads.What I want's to do is to have a check the method of thread A that while it is runing thread B can't be call.

    What Can I do

    Also I have't used thread monitor prior to this.So little bit explain how it will be beneficial in my case

    see my response to your synchronization post in .Net compact framework forum section, I think that applies here.

    if you want to have some sort of inter-thread communication, you'll want to use synchronization. another option that's less thread-centric is to have an external resource making the state of relevant objects in each thread available to other threads -- such as serializing, whether to binary or to xml, to a location both threads can check. but that's a lot of work, a synchronized code block alone should take care of this.


  • How to set Pocket outlook thread safe