🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5952

Re: Callback mechanics

#5952
From: Remy Lebeau (TeamB)
Date: Wed, 22 Jun 2005 06:26
28 lines
1654 bytes
"AlexB" <b.a.v@inbox.ru> wrote in message
news:42b8e174$1@newsgroups.borland.com...

> // main thread, multimedia timer
> mmt=timeSetEvent(

A multimedia timer is essentially just a worker thread that calls the
callback function in a loop.

> while(1)            // forever
> { // VCL in progress
>   StringList->Lines->Add(...);
> }
>
> ...
> void CALLBACK mmtCallback(UINT wTimerID, UINT msg,
>      DWORD dwUser, DWORD dw1, DWORD dw2)
> {
>   StringList->Lines->Add(...);
> }

That code is not thread-safe.  You must protect access to the TStringList by
using a synchronization object, such as a critical section, mutex,
semaphore, etc.


Gambit
Technical Details
Message-ID: <42b90490@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42b7fc1d$1@newsgroups.borland.com> <42b84cd0$1@newsgroups.borland.com> <42b8e174$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bcabb6910c82b605
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42b7fc1d$1@newsgroups.borland.com> <42b84cd0$1@newsgroups.borland.com> <42b8e174$1@newsgroups.borland.com>
Subject: Re: Callback mechanics
Date: Tue, 21 Jun 2005 23:26:24 -0700
Lines: 30
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: <42b90490@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1119421584 68.69.17.41 (21 Jun 2005 23:26:24 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail