Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by mike
Thu, 22 Jul 2004 16:55
Blocking Sockets and Synconize
Author: mike
Date: Thu, 22 Jul 2004 16:55
Date: Thu, 22 Jul 2004 16:55
8 lines
1178 bytes
1178 bytes
Could someone clarify my understanding of when to use Syncronize in a blocking thread. I understand that when doing anything with a form then I should use Syncronize, but the question I have is if I am using a Data Module to access a database should I also use Syncronize. Thanks very much for any information Mike
Re: Blocking Sockets and Synconize
Author: Remy Lebeau (TeamB)
Date: Sun, 25 Jul 2004 20:11
Date: Sun, 25 Jul 2004 20:11
26 lines
2001 bytes
2001 bytes
"mike" <mfbrowne@earthlink.net> wrote in message news:4103c5b6$1@newsgroups.borland.com... > Could someone clarify my understanding of when > to use Syncronize in a blocking thread. Call Synchronize() whenever you want to make a serialized call, meaning that a given block of code is only called by one thread at a time instead of in parallel simultaneously. This is particularly important to do when a thread wants to access the main thread's GUI, for instance. > I understand that when doing anything with a form then > I should use Syncronize, but the question I have is if I am > using a Data Module to access a database should I also > use Syncronize. In general, yes. However, some databases support multi-threaded sessions, so if you are using such a database, then you can give each thread its own session object and they will have the database synchronizing for your internally. The alternative is to make a dedicated database thread and then have your other threads post requests to that thread, so that only one actual thread is ever accessing the database. Gambit
Re: Blocking Sockets and Synconize
Author: mike
Date: Tue, 27 Jul 2004 14:29
Date: Tue, 27 Jul 2004 14:29
44 lines
2408 bytes
2408 bytes
Remy, Thanks for your response, allways appreciated. Just for my understanding, what are the possible effects of not using Syncronize in a thread. Thanks Mike "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:410413c0$1@newsgroups.borland.com... > > "mike" <mfbrowne@earthlink.net> wrote in message > news:4103c5b6$1@newsgroups.borland.com... > > > Could someone clarify my understanding of when > > to use Syncronize in a blocking thread. > > Call Synchronize() whenever you want to make a serialized call, meaning that > a given block of code is only called by one thread at a time instead of in > parallel simultaneously. This is particularly important to do when a thread > wants to access the main thread's GUI, for instance. > > > I understand that when doing anything with a form then > > I should use Syncronize, but the question I have is if I am > > using a Data Module to access a database should I also > > use Syncronize. > > In general, yes. However, some databases support multi-threaded sessions, > so if you are using such a database, then you can give each thread its own > session object and they will have the database synchronizing for your > internally. The alternative is to make a dedicated database thread and then > have your other threads post requests to that thread, so that only one > actual thread is ever accessing the database. > > > Gambit > >
Re: Blocking Sockets and Synconize
Author: Remy Lebeau (TeamB)
Date: Tue, 27 Jul 2004 18:20
Date: Tue, 27 Jul 2004 18:20
11 lines
1207 bytes
1207 bytes
"mike" <mfbrowne@earthlink.net> wrote in message news:410666d6$1@newsgroups.borland.com... > Just for my understanding, what are the possible effects > of not using Syncronize in a thread. Crashes, deadlocks, undefined behavior, etc. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads