Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14836
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: copy/pass a va_list to another thread |
| Date | 2012-03-08 21:41 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <jjb5ih$aoc$1@dont-email.me> (permalink) |
| References | <15783154.7098.1331159818084.JavaMail.geo-discussion-forums@vbgu10> <jj90iv$2je$1@dont-email.me> <7509868.1455.1331236446852.JavaMail.geo-discussion-forums@ynjd19> |
On 08.03.2012 20:54, Christopher wrote:
[snip text]
>
> // Creates a database log record
> // \param sprintf like message string including placeholders
> // \param ... - takes tuples
> // 1- string; name of argument
> // 2- string; formatting code string
> // 3- any type; identified by previous formatting code
> //<list of 500 formatting codes and argument types>
> void SomeFunction(std::wstring message, ...) // Cannot change
> {
> va_list va; // May change anything here down
> va_start(va, x);
>
> SomeDataStructure myOutput; // Contains arguments for a database call
> // to create a log record
> // which is also crappy design
> // with tons of params
> // and encoded, formatted, strings
>
> // 4000 lines of parsing custom format codes and arguments,
> // converting to types
> // using those types to build strings
> // ala sprintf
> // With a dump truck of business rules applied to string encoding
> // AKA long and tedious stuff that I want to do on another thread
> // Including actually making a call to write to database which is
> // also time consuming
> //
> // i.e. This is a logging type method and should return immediatly
>
> va_end(va);
> }
[snip text]
First, PLEASE DO NOT POST WITH QUOTED PRINTABLE FORMAT.
It really really sucks.
I see you're posting via Google. They have tried umpteen times to kill
Usenet. Why they're still bothering to kill a dead horse is beyond me,
perhaps the Google people doing Google Groups stuff now are just grossly
technically incompetent and also unaware of history, but anyway, please
don't post with quoted printable, like, please do not go naked and
unwashed into a restaurant or, for that matter, bookstore.
That said (phew!), your task, except for error handling, is easy but
tedious.
You need to parse the format string and retrieve the original argument
values. Possibly you can get by with just storing a string
representation of each argument value. Otherwise, a heterogeneous list
is easy to do in C++, check out boost::variant and boost::any. Pass the
argument collection etc. to the thread.
Error handling problem: how to notify the calling code, which presumably
is unaware of the asynchronous nature of the call, of errors and failures.
It might be a Good Idea(TM) to really think about that before embarking
on the easy but very tedious task outlined above. <g>
Cheers & hth.,
- Alf
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
copy/pass a va_list to another thread Christopher <cpisz@austin.rr.com> - 2012-03-07 14:36 -0800
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-08 02:04 +0100
Re: copy/pass a va_list to another thread Christopher <cpisz@austin.rr.com> - 2012-03-08 11:54 -0800
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-08 21:41 +0100
Re: copy/pass a va_list to another thread Christopher <cpisz@austin.rr.com> - 2012-03-08 13:56 -0800
OT: Free Usenet Access red floyd <no.spam.here@its.invalid> - 2012-03-08 16:09 -0800
Re: OT: Free Usenet Access Christopher Pisz <someone@somewhere.net> - 2012-03-09 10:26 -0600
New Google Groups problems (was Re: copy/pass a va_list to another thread) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-09 12:27 +0000
Re: copy/pass a va_list to another thread Robert Miles <milesrf@Usenet-News.net> - 2012-04-21 23:43 -0500
XSUsenet.COM @Jeff-Relf.Me - 2012-04-21 22:12 -0700
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-10 05:12 +0900
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-10 00:00 +0100
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-10 08:40 +0900
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-10 08:42 +0900
MIME (Re: copy/pass a va_list to another thread) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-10 07:04 +0000
Re: MIME (Re: copy/pass a va_list to another thread) Miles Bader <miles@gnu.org> - 2012-03-10 16:56 +0900
Re: MIME (Re: copy/pass a va_list to another thread) Gareth Owen <gwowen@gmail.com> - 2012-03-11 07:37 +0000
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-10 10:44 +0100
Re: copy/pass a va_list to another thread Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-10 14:43 +0000
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-10 21:17 +0100
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-11 10:49 +0900
Re: copy/pass a va_list to another thread Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-11 07:11 +0000
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-11 19:03 +0900
Re: copy/pass a va_list to another thread Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-11 11:49 +0000
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-11 23:01 +0900
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-11 18:25 +0100
Re: copy/pass a va_list to another thread Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-11 23:53 +0000
Re: copy/pass a va_list to another thread Mike McCarty <mcmccarty@gmail.com> - 2012-03-10 05:47 -0800
Re: copy/pass a va_list to another thread Dombo <dombo@disposable.invalid> - 2012-03-10 19:51 +0100
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-10 21:23 +0100
Re: copy/pass a va_list to another thread Dombo <dombo@disposable.invalid> - 2012-03-11 14:36 +0100
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-11 18:33 +0100
Re: copy/pass a va_list to another thread Dombo <dombo@disposable.invalid> - 2012-03-11 20:41 +0100
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-11 21:49 +0100
Re: copy/pass a va_list to another thread Rui Maciel <rui.maciel@gmail.com> - 2012-03-11 17:18 +0000
Re: copy/pass a va_list to another thread "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-03-11 18:39 +0100
Re: copy/pass a va_list to another thread Rui Maciel <rui.maciel@gmail.com> - 2012-03-11 18:54 +0000
Re: copy/pass a va_list to another thread Christian Gollwitzer <auriocus@gmx.de> - 2012-03-12 19:03 +0100
Re: copy/pass a va_list to another thread Rui Maciel <rui.maciel@gmail.com> - 2012-03-11 17:09 +0000
Re: copy/pass a va_list to another thread scott@slp53.sl.home (Scott Lurndal) - 2012-03-11 01:26 +0000
Re: copy/pass a va_list to another thread Miles Bader <miles@gnu.org> - 2012-03-11 11:18 +0900
Re: copy/pass a va_list to another thread scott@slp53.sl.home (Scott Lurndal) - 2012-03-11 16:41 +0000
Re: copy/pass a va_list to another thread scott@slp53.sl.home (Scott Lurndal) - 2012-03-08 23:07 +0000
Re: copy/pass a va_list to another thread Paavo Helde <myfirstname@osa.pri.ee> - 2012-03-08 23:17 -0600
Re: copy/pass a va_list to another thread Stuart Redmann <DerTopper@web.de> - 2012-03-10 05:10 -0800
Re: copy/pass a va_list to another thread 88888 Dihedral <dihedral88888@googlemail.com> - 2012-03-10 05:42 -0800
Re: copy/pass a va_list to another thread Robert Miles <milesrf@Usenet-News.net> - 2012-04-21 23:20 -0500
Re: copy/pass a va_list to another thread BGB <cr88192@hotmail.com> - 2012-03-08 09:25 -0700
csiph-web