Thread issue ??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tlink

    #1

    Thread issue ??

    I have a master control program that needs to run continuously, accepting
    data and updating a datagrid for the user. As a result I have setup 2
    threads, one accepts and processes incoming requests and updates the
    database, whilst the other thread is started once a update has been
    committed to the database. The problem is when the datagrid is accessed
    after the first time it is unable to access the datagrid (Cannot clear this
    list)?

    I have delegated the threads and also checked and invoked the thread as
    below: The listenthread functions without issue as it never stops running,
    whilst the tableupdate thread terminates when no vieweable data alters. Any
    help or guidance would be greatly appreciated.

    Delegate Sub CreateDataSourc eCallBack()
    Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
    Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
    *** wrapped in a try ***

    If Me.DGV1.InvokeR equired = True Then
    Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
    CreateDataSourc e)
    Me.Invoke(invok e_createdatasou rce)
    Else
    Me.DGV1.Rows.Cl ear()
    update grid here.......

    I reset the thread to update the table as listed below:
    If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
    Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
    Me.CreateDataSo urce))
    Me.ThreadTableU pdate.Start()
    End If




  • Cor Ligthert [MVP]

    #2
    Re: Thread issue ??

    Tlink,


    It looks if you try to create a connected application using a Dataset. If
    you are updatating the datasource of you cannot in the same time refill
    that. It has to be one by one and needs too time time, that your user is
    able to do as well things. You are pulling on four sides of the datagrid.
    (Filling, updating from it by the database, Reading by the user, updating by
    the user). This kind of operations are and stay forever serial and are not
    parallel. (Although they can exist in any sequence as is needed).

    Just my thought reading your message.

    Cor

    "Tlink" <Tlink@online.n ospam> schreef in bericht
    news:uZuUrEzgGH A.4052@TK2MSFTN GP02.phx.gbl...[color=blue]
    >I have a master control program that needs to run continuously, accepting
    >data and updating a datagrid for the user. As a result I have setup 2
    >threads, one accepts and processes incoming requests and updates the
    >database, whilst the other thread is started once a update has been
    >committed to the database. The problem is when the datagrid is accessed
    >after the first time it is unable to access the datagrid (Cannot clear this
    >list)?
    >
    > I have delegated the threads and also checked and invoked the thread as
    > below: The listenthread functions without issue as it never stops running,
    > whilst the tableupdate thread terminates when no vieweable data alters.
    > Any help or guidance would be greatly appreciated.
    >
    > Delegate Sub CreateDataSourc eCallBack()
    > Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
    > Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
    > *** wrapped in a try ***
    >
    > If Me.DGV1.InvokeR equired = True Then
    > Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
    > CreateDataSourc e)
    > Me.Invoke(invok e_createdatasou rce)
    > Else
    > Me.DGV1.Rows.Cl ear()
    > update grid here.......
    >
    > I reset the thread to update the table as listed below:
    > If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
    > Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
    > Me.CreateDataSo urce))
    > Me.ThreadTableU pdate.Start()
    > End If
    >
    >
    >
    >[/color]


    Comment

    • Tlink

      #3
      Re: Thread issue ??

      I am unsure as to your response, what I am doing perhaps explained:

      One thread that updates the database

      One thread that reads the database and updates the datagrid

      Does this help, as I am still confused?

      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
      news:eU%23eqn0g GHA.3756@TK2MSF TNGP02.phx.gbl. ..[color=blue]
      > Tlink,
      >
      >
      > It looks if you try to create a connected application using a Dataset. If
      > you are updatating the datasource of you cannot in the same time refill
      > that. It has to be one by one and needs too time time, that your user is
      > able to do as well things. You are pulling on four sides of the datagrid.
      > (Filling, updating from it by the database, Reading by the user, updating
      > by the user). This kind of operations are and stay forever serial and are
      > not parallel. (Although they can exist in any sequence as is needed).
      >
      > Just my thought reading your message.
      >
      > Cor
      >
      > "Tlink" <Tlink@online.n ospam> schreef in bericht
      > news:uZuUrEzgGH A.4052@TK2MSFTN GP02.phx.gbl...[color=green]
      >>I have a master control program that needs to run continuously, accepting
      >>data and updating a datagrid for the user. As a result I have setup 2
      >>threads, one accepts and processes incoming requests and updates the
      >>database, whilst the other thread is started once a update has been
      >>committed to the database. The problem is when the datagrid is accessed
      >>after the first time it is unable to access the datagrid (Cannot clear
      >>this list)?
      >>
      >> I have delegated the threads and also checked and invoked the thread as
      >> below: The listenthread functions without issue as it never stops
      >> running, whilst the tableupdate thread terminates when no vieweable data
      >> alters. Any help or guidance would be greatly appreciated.
      >>
      >> Delegate Sub CreateDataSourc eCallBack()
      >> Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
      >> Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
      >> *** wrapped in a try ***
      >>
      >> If Me.DGV1.InvokeR equired = True Then
      >> Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
      >> CreateDataSourc e)
      >> Me.Invoke(invok e_createdatasou rce)
      >> Else
      >> Me.DGV1.Rows.Cl ear()
      >> update grid here.......
      >>
      >> I reset the thread to update the table as listed below:
      >> If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
      >> Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
      >> Me.CreateDataSo urce))
      >> Me.ThreadTableU pdate.Start()
      >> End If
      >>
      >>
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Thread issue ??

        Tlink,

        What I want to say, is that the use of threads has in my opinion absolute no
        sense.

        The processes are complete serialized, so threads gives you only overhead
        and trouble.

        Cor

        "Tlink" <Tlink@online.n ospam> schreef in bericht
        news:%23HIR8a5g GHA.3652@TK2MSF TNGP02.phx.gbl. ..[color=blue]
        >I am unsure as to your response, what I am doing perhaps explained:
        >
        > One thread that updates the database
        >
        > One thread that reads the database and updates the datagrid
        >
        > Does this help, as I am still confused?
        >
        > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
        > news:eU%23eqn0g GHA.3756@TK2MSF TNGP02.phx.gbl. ..[color=green]
        >> Tlink,
        >>
        >>
        >> It looks if you try to create a connected application using a Dataset.
        >> If you are updatating the datasource of you cannot in the same time
        >> refill that. It has to be one by one and needs too time time, that your
        >> user is able to do as well things. You are pulling on four sides of the
        >> datagrid. (Filling, updating from it by the database, Reading by the
        >> user, updating by the user). This kind of operations are and stay forever
        >> serial and are not parallel. (Although they can exist in any sequence as
        >> is needed).
        >>
        >> Just my thought reading your message.
        >>
        >> Cor
        >>
        >> "Tlink" <Tlink@online.n ospam> schreef in bericht
        >> news:uZuUrEzgGH A.4052@TK2MSFTN GP02.phx.gbl...[color=darkred]
        >>>I have a master control program that needs to run continuously, accepting
        >>>data and updating a datagrid for the user. As a result I have setup 2
        >>>threads, one accepts and processes incoming requests and updates the
        >>>database, whilst the other thread is started once a update has been
        >>>committed to the database. The problem is when the datagrid is accessed
        >>>after the first time it is unable to access the datagrid (Cannot clear
        >>>this list)?
        >>>
        >>> I have delegated the threads and also checked and invoked the thread as
        >>> below: The listenthread functions without issue as it never stops
        >>> running, whilst the tableupdate thread terminates when no vieweable data
        >>> alters. Any help or guidance would be greatly appreciated.
        >>>
        >>> Delegate Sub CreateDataSourc eCallBack()
        >>> Private ThreadListen As New Thread(AddressO f ListenServerThr ead)
        >>> Private ThreadTableUpda te As New Thread(AddressO f CreateDataSourc e)
        >>> *** wrapped in a try ***
        >>>
        >>> If Me.DGV1.InvokeR equired = True Then
        >>> Dim invoke_createda tasource As New CreateDataSourc eCallBack(Addre ssOf
        >>> CreateDataSourc e)
        >>> Me.Invoke(invok e_createdatasou rce)
        >>> Else
        >>> Me.DGV1.Rows.Cl ear()
        >>> update grid here.......
        >>>
        >>> I reset the thread to update the table as listed below:
        >>> If ThreadTableUpda te.ThreadState = ThreadState.Sto pped Then
        >>> Me.ThreadTableU pdate = New Thread(New ThreadStart(Add ressOf
        >>> Me.CreateDataSo urce))
        >>> Me.ThreadTableU pdate.Start()
        >>> End If
        >>>
        >>>
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...