Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14867
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: copy/pass a va_list to another thread |
| Date | 2012-03-10 05:42 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <18418776.68.1331386976492.JavaMail.geo-discussion-forums@pbcjk1> (permalink) |
| References | <15783154.7098.1331159818084.JavaMail.geo-discussion-forums@vbgu10> <jj90iv$2je$1@dont-email.me> <7509868.1455.1331236446852.JavaMail.geo-discussion-forums@ynjd19> |
Christopher於 2012年3月9日星期五UTC+8上午3時54分06秒寫道:
> On Wednesday, March 7, 2012 7:04:26 PM UTC-6, Alf P. Steinbach wrote:
> > You have already stated that copying takes too long.
> >
> > And you can't pass a reference or pointer to it without letting the
> > original thread wait.
> >
> > So at first glance the problem is insoluble.
>
> Maybe. I am hoping for some boost or C++ standard mechanism, which I haven't heard of yet, that solves this problem that I presume many developers have run across, when dealing with a function that takes a variable argument list parameter.
>
> > Just post real code instead of a vague and most likely incorrect
> > description.
>
> I think you are reading to much into it and want to look at the design for a fix. I don't blame you. I already accept that the design is flawed, the code sucks, and I'd never use a variable argument list in the first place. Such is often life when dealing with other people's real life code and manager's rules and time allotments vs academic examples. Given those constants, it doesn't matter what the context is, but here:
>
> // 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);
> }
>
> The actual conversion from unknown types into usuable typed objects using format codes in strings is what is taking a long time. I really don't think I mentioned copying as you say. There is no copying yet. I envision copying as a means to pass them to another thread. As obviously I can't give something to another thread from the stack without blocking the first thread or they will no longer be valid.
>
> The problem itself is how to copy something of unknown type and length from the "stack pointer?" given by va_list, without actually processing the list to find the types first.
>
> performance analysis revealed that the processing of the list, just to extract the types and use them to build the output to make the database call with, took longer than the database call itself!
Christopher於 2012年3月9日星期五UTC+8上午3時54分06秒寫道:
> On Wednesday, March 7, 2012 7:04:26 PM UTC-6, Alf P. Steinbach wrote:
> > You have already stated that copying takes too long.
> >
> > And you can't pass a reference or pointer to it without letting the
> > original thread wait.
> >
> > So at first glance the problem is insoluble.
>
> Maybe. I am hoping for some boost or C++ standard mechanism, which I haven't heard of yet, that solves this problem that I presume many developers have run across, when dealing with a function that takes a variable argument list parameter.
>
> > Just post real code instead of a vague and most likely incorrect
> > description.
>
> I think you are reading to much into it and want to look at the design for a fix. I don't blame you. I already accept that the design is flawed, the code sucks, and I'd never use a variable argument list in the first place. Such is often life when dealing with other people's real life code and manager's rules and time allotments vs academic examples. Given those constants, it doesn't matter what the context is, but here:
>
> // 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);
> }
>
> The actual conversion from unknown types into usuable typed objects using format codes in strings is what is taking a long time. I really don't think I mentioned copying as you say. There is no copying yet. I envision copying as a means to pass them to another thread. As obviously I can't give something to another thread from the stack without blocking the first thread or they will no longer be valid.
>
> The problem itself is how to copy something of unknown type and length from the "stack pointer?" given by va_list, without actually processing the list to find the types first.
>
> performance analysis revealed that the processing of the list, just to extract the types and usfuncte them to build the output to make the database call with, took longer than the database call itself!
I don't like this tyle of coding, and I'll suggest to use an input vector
to be passed to a function thus that all parameters are received in
the callee function to start the action.
Well, to pass by register does matter a lot in calling work-horse level
actions.
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