Article View: borland.public.cppbuilder.internet.socket
Article #5616Re: Blocking Sockets and Synconize
From: 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
Technical Details
Message-ID:
<410413c0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4103c5b6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,98e571834798f748 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4103c5b6$1@newsgroups.borland.com> Subject: Re: Blocking Sockets and Synconize Date: Sun, 25 Jul 2004 13:11:54 -0700 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <410413c0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1090786240 68.69.17.41 (25 Jul 2004 13:10:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail