 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Gebhart Guest
|
Posted: Sat Dec 18, 2004 6:44 pm Post subject: Exakteres cout |
|
|
Hi zusammen,
ich habe eine Anwendung mit mehreren Threads und lass mir zum Debuggen mit
cout ein paar Meldungen ausgeben. Jedoch scheint cout nicht sonderlich
exakt zu sein, denn die Meldungen erscheinen nicht in der Reihenfolge, wie
sie eigentlich müssten.
Beispiel:
Ich habe vor jedem Lock eines Mutexes eine Ausgabe, die mir zeigt, welcher
Mutex von wem gelockt wurde. Laut der Ausgabe habe ich aber zwei Locks
hintereinander vom selben Mutex, was ja nicht sein kann. Von daher muss die
Ausgabe von cout irgendwie verzögert sein. Gibts da irgendwas anderes, wo
solche Verfälschungen nicht auftreten können?
Gruß
Michael
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Michael Karcher Guest
|
Posted: Mon Dec 20, 2004 12:16 pm Post subject: Re: Exakteres cout |
|
|
Michael Gebhart <mail (AT) miketech (DOT) net> wrote:
| Quote: | cout ein paar Meldungen ausgeben. Jedoch scheint cout nicht sonderlich
exakt zu sein, denn die Meldungen erscheinen nicht in der Reihenfolge, wie
sie eigentlich müssten.
Hast Du schon mal flush() probiert? |
Michael Karcher
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Mon Dec 20, 2004 12:25 pm Post subject: Re: Exakteres cout |
|
|
Michael Gebhart wrote:
| Quote: | Hi zusammen,
ich habe eine Anwendung mit mehreren Threads und lass mir zum Debuggen mit
cout ein paar Meldungen ausgeben. Jedoch scheint cout nicht sonderlich
exakt zu sein, denn die Meldungen erscheinen nicht in der Reihenfolge, wie
sie eigentlich müssten.
|
Das hat nichts mit "exakt" zu tun, sondern vermutlich eher damit, daß die
Ausgabedaten in der Regel gepuffert werden.
| Quote: | Beispiel:
Ich habe vor jedem Lock eines Mutexes eine Ausgabe, die mir zeigt, welcher
Mutex von wem gelockt wurde. Laut der Ausgabe habe ich aber zwei Locks
hintereinander vom selben Mutex, was ja nicht sein kann.
|
Wieso? Wenn du zuerst die Ausgabe machst, dann den Lock, dann macht Thread 1
die Ausgabe, lockt den Mutex und geht weiter. Dann wird er von Thread 2
unterbrochen, der macht dann auch die Ausgabe (also haben wir zwei
hintereinander) und versucht ebenfalls den Lock, bleibt dann aber stehen,
weil Thread 1 noch den Lock hat.
| Quote: | Von daher muss die Ausgabe von cout irgendwie verzögert sein. Gibts da
irgendwas anderes, wo solche Verfälschungen nicht auftreten können?
|
Die C++-Norm sagt nichts über Threads aus, daher ist die Verträglichkeit der
Ausgabestreams (oder irgendwelcher anderer C++-Klassen) mit Threads immer
plattformabhängig.
Wie schreibst du denn die Augabe? Beendest du sie mit std::endl, oder
std::flush, damit der Puffer auch rausgeschrieben wird?
Du könntest statt cout auch mal clog probieren. Das ist wie cout, aber nicht
gepuffert.
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Marcel Müller Guest
|
Posted: Mon Dec 20, 2004 12:44 pm Post subject: Re: Exakteres cout |
|
|
Michael Gebhart wrote:
| Quote: | Ich habe vor jedem Lock eines Mutexes eine Ausgabe, die mir zeigt, welcher
^^^ |
Kein Wunder.
Zu diesem Zeitpunkt ist das Mutex ja noch nicht synchronisiert.
| Quote: | Mutex von wem gelockt wurde. Laut der Ausgabe habe ich aber zwei Locks
hintereinander vom selben Mutex, was ja nicht sein kann. Von daher muss die
Ausgabe von cout irgendwie verzögert sein.
|
Den Schluß halte ich für /sehr/ voreilig.
Code-Beispiel?
| Quote: | Gibts da irgendwas anderes, wo
solche Verfälschungen nicht auftreten können?
|
cerr
Marcel
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
kanze@gabi-soft.fr Guest
|
Posted: Mon Dec 20, 2004 5:05 pm Post subject: Re: Exakteres cout |
|
|
Rolf Magnus wrote:
| Quote: | Michael Gebhart wrote:
Du könntest statt cout auch mal clog probieren. Das ist wie cout,
aber
nicht gepuffert.
|
Du meinst, das ist wie cerr, aber gepuffert.
--
James Kanze GABI Software http://www.gabi-soft.fr
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Mon Dec 20, 2004 5:13 pm Post subject: Re: Exakteres cout |
|
|
[email]kanze (AT) gabi-soft (DOT) fr[/email] wrote:
| Quote: | Rolf Magnus wrote:
Michael Gebhart wrote:
Du könntest statt cout auch mal clog probieren. Das ist wie cout,
aber nicht gepuffert.
Du meinst, das ist wie cerr, aber gepuffert.
|
Das hatte ich zwar nicht gemeint, aber ich habe meine Meinung geändert ;-)
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Philipp Unterbrunner Guest
|
Posted: Thu Dec 23, 2004 1:55 am Post subject: Re: Exakteres cout |
|
|
"Michael Gebhart" schrieb:
| Quote: | Ich habe vor jedem Lock eines Mutexes eine Ausgabe, die mir zeigt, welcher
Mutex von wem gelockt wurde. Laut der Ausgabe habe ich aber zwei Locks
hintereinander vom selben Mutex, was ja nicht sein kann. Von daher muss
die
Ausgabe von cout irgendwie verzögert sein. Gibts da irgendwas anderes, wo
solche Verfälschungen nicht auftreten können?
|
Dein Problem beinhaltet genau genommen 2 Dinge.
1. cout ist gepuffert. Willst du sofortige Ausgabe erzwingen verwende
flush() oder einfach cerr.
2. Die Reihenfolge von Code zwischen 2 Memory Barriers (wovon ein Mutex Lock
eine ist) ist nicht definiert. Selbst wenn du dir die Uhrzeit loggst in
beiden Threads und *weisst* dass der eine Thread schneller war als der
andere, bedeutet dass nicht, dass die gemeinsamen Auswirkungen der
Reihenfolge der gemeinsamen Aktionen entsprechen, ganz einfach weil der
*Speicher* nicht notwendigerweise synchronisiert wurde.
Problem 2 tritt meines Wissens nach nur in Multiprozessor Umgebungen auf und
Punkt 1 erklärt deine Doppel-Lock Berichte nicht, von daher vermute ich dass
(auch) der Code fehlerhaft ist.
Philipp
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
kanze@gabi-soft.fr Guest
|
Posted: Sat Dec 25, 2004 7:04 pm Post subject: Re: Exakteres cout |
|
|
the time you turn the child?s breast into
cutlets, it will be indistinguishable. The taste of young human,
although similar to turkey (and chicken) often can be wildly
different depending upon what he or she has consumed during its
10 to 14 months of life...
4 well chosen cutlets (from the breasts of 2 healthy neonates)
2 large lemons (fresh lemons always, if possible)
Olive oil
Green onions
Salt
pepper
cornstarch
neonate stock (chicken, or turkey stock is fine)
garlic
parsley
fresh cracked black pepper
Season and sauté the cutlets in olive oil till golden brown, remove.
Add the garlic and onions and cook down a bit.
Add some lemon juice and some zest, then de-glaze with stock.
Add a little cornstarch (dissolved in cold water) to the sauce.
You are just about there, Pour the sauce over the cutlets,
top with parsley, lemon slices and cracked pepper.
Serve with spinach salad, macaroni and cheese (homemade) and iced tea...
Spaghetti with Real Italian Meatballs
If you don?t have an expendable bambino on hand,
you can use a pound of ground pork instead.
The secret to g
|
|
| Back to top |
|
 |
Michael Karcher Guest
|
Posted: Sat Dec 25, 2004 7:20 pm Post subject: Re: Exakteres cout |
|
|
the stock thick.
Remove the carcass and add the vegetables slowly to the stock,
so that it remains boiling the whole time.
Cover the pot and simmer till vegetables are tender
(2 hours approximately).
Continue seasoning to taste.
Before serving, add butter and pasta,
serve piping with hot bread and butter.
Offspring Rolls
Similar to Vietnamese style fried rolls, they have lots of meat
(of course this can consist of chicken, beef, pork, or shrimp).
Who can resist this classic appetizer; or light lunch served with
a fresh salad? Versatility is probably this recipe?s greatest virtue,
as one can use the best part of a prime, rare, yearling, or the
morticians occasional horror: a small miracle stopped short by a
drunk driver, or the innocent victim of a drive-by shooting...
2 cups finely chopped very young human flesh
1 cup shredded cabbage
1 cup bean sprouts
5 sprigs green onion, finely chopped
5 cloves minced garlic
4-6 ounces bamboo shoots
Sherry
chicken broth
oil for deep frying (1 gallon)
Salt
pepper
soy & teriyaki
minced ginger, etc.
1 tablespoon cornstarch dissolved in a little cold water
1 egg beaten
Make the stuffing:
Marinate the flesh in a mixture of soy and teriyaki sauces
then stir fry in hot oil for till brown - about 1 minute, remove.
Stir-fry the vegetables.
Put the meat back into the wok and adjust the seasoning.
De-glaze with sherry, cooking off the alcohol.
Add broth (optional) cook a few more minutes.
Add the cornstarch, cook a few minutes till thick,
then place the stuffing into a colander and cool;
2 hours
Wrap the rolls:
Place 3 tablespoons of stuffing in the wrap, roll tightly -
corner nearest you first, fold 2 side corners in,
wrap till remaining corner is left.
Brush with egg, seal, and allow to sit on the seal for
a few minutes.
Fry the rolls:
325° if using egg roll wraps, 350° f
|
|
| Back to top |
|
 |
Philipp Unterbrunner Guest
|
Posted: Sat Dec 25, 2004 9:17 pm Post subject: Re: Exakteres cout |
|
|
cucumber salad, fruit salad
Bran muffins, dinner rolls, soft breadsticks, rice pilaf, croissants
Apple cake with rum sauce, frosted banana nut bread sherbet, home made brownies
Iced tea, water, beer, bloody marys, lemonade, coffee
The guests select food, beverages, silverware... everything from the buffet table.
They move to wherever they are comfortable, and sit with whoever they choose.
Provide trays so your guests will not spill everything all over your house from
carrying too much, nor will they have to make 10 trips back and fourth from the
service stations.
Roast Leg of Amputee
By all means, substitute lamb or a good beef roast if the haunch
it is in any way diseased. But sometimes surgeons make mistakes,
and if a healthy young limb is at hand, then don?t hesitate to cook
it to perfection!
1 high quality limb, rack, or roast
Potatoes, carrot
Oil
celery
onions
green onions
parsley
garlic
salt, pepper, etc
2 cups beef stock
Marinate meat (optional, not necessary with better cuts).
Season liberally and lace with garlic cloves by making incisions,
and placing whole cloves deep into the meat.
Grease a baking pan, and fill with a thick bed of onions,
celery, green onions, and parsley.
Place roast on top with fat side up.
Place uncovered in 500° oven for 20 minutes, reduce oven to 325°.
Bake till medium rare (150°) and let roast rest.
Pour stock over onions and drippings, carve
|
|
| Back to top |
|
 |
Michael Karcher Guest
|
Posted: Sat Dec 25, 2004 9:26 pm Post subject: Re: Exakteres cout |
|
|
Bleu
Nothing is so beautiful as the bond between mother and child,
so why not consume it?
Children or chicken breasts will work wonderfully also.
4 whole umbilical chords (or baby breasts, or chicken breasts)
4 thin slices of smoked ham, and Gruyere cheese
Flour
eggwash (milk and eggs)
seasoned bread crumbs
1 onion
minced
salt
pepper
butter
olive oil
Pound the breasts flat (parboil first if using umbilical
cords so they won?t be tough).
Place a slice of ham and cheese on each, along with some minced onion
then fold in half, trimming neatly.
Dredge in flour, eggwash, then seasoned breadcrumbs;
allow to sit for a few minutes.
Sauté in butter and olive oil until golden brown,
about 6 minutes on each side.
Shish Kababes
As old as the hills, this technique has employed seafood, beef, pork, lamb,
poultry, and vegetables; just about anything can be grilled, and young humans
are no exception!
High quality marinade (Teriyaki and garlic perhaps)
1 inch cubes of tender meat, preferably from the nursery
Onions
bell peppers
Wooden or metal skewers
Marinate the meat overnight.
Get the grill good and hot while placing meat, vegetables, and
fruit such as pineapples or cherries on the skewers.
Don?t be afraid to use a variety of meats.
Grill to medium rare,
serve wit
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Sat Dec 25, 2004 9:28 pm Post subject: Re: Exakteres cout |
|
|
will need one for the top also).
Boil the prepared delicacy until the meat starts to come off the bones.
Remove, de-bone and cube; continue to reduce the broth.
Brown the onions, peppers and celery.
Add the meat then season, continue browning.
De-glaze with sherry, add the reduced broth.
Finally, put in the root vegetables and simmer for 15 minutes.
Allow to cool slightly.
Place the pie pan in 375 degree oven for a few minutes so bottom crust is not soggy,
reduce oven to 325.
Fill the pie with stew, place top crust and with a fork, seal the crusts together
then poke holes in top.
Return to oven and bake for 30 minutes, or until pie crust is golden brown.
Sudden Infant Death Soup
SIDS: delicious in winter, comparable to old fashioned Beef and Vegetable Soup.
Its free, you can sell the crib, baby clothes, toys, stroller... and so easy to
procure if such a lucky find is at hand (just pick him up from the crib and
he?s good to go)!
SIDS victim, cleaned
½ cup cooking oil
Carrots
onions
broccoli
whole cabbage
fresh green beans
potato
turnip
celery
tomato
½ stick butter
1 cup cooked pasta (macaroni, shells, etc.)
Remove as much meat as possible, cube, and brown in hot oil.
Add a little water, season, then add the carcass.
Simmer for half an hour keeping the stock thick.
Remove the carcass and add the vegetables slowl
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Sat Dec 25, 2004 10:19 pm Post subject: Re: Exakteres cout |
|
|
golden brown, drain on paper towels.
Lemon Neonate
Turkey serves just as well, and in fact even looks a bit like a
well-dressed baby. By the time you turn the child?s breast into
cutlets, it will be indistinguishable. The taste of young human,
although similar to turkey (and chicken) often can be wildly
different depending upon what he or she has consumed during its
10 to 14 months of life...
4 well chosen cutlets (from the breasts of 2 healthy neonates)
2 large lemons (fresh lemons always, if possible)
Olive oil
Green onions
Salt
pepper
cornstarch
neonate stock (chicken, or turkey stock is fine)
garlic
parsley
fresh cracked black pepper
Season and sauté the cutlets in olive oil till golden brown, remove.
Add the garlic and onions and cook down a bit.
Add some lemon juice and some zest, then de-glaze with stock.
Add a little cornstarch (dissolved in cold water) to the sauce.
You are just about there, Pour the sauce over the cutlets,
top with parsley, lemon slices and cracked pepper.
Serve with spinach salad, macaroni and cheese (homemade) and iced tea...
Spaghetti with Real Italian Meatballs
If you don?t have an expendable bambino on hand,
you can use a pound of ground pork instead.
The secret to great meatballs, is to use very lean meat.
1 lb. gr
|
|
| Back to top |
|
 |
Philipp Unterbrunner Guest
|
Posted: Sat Dec 25, 2004 10:57 pm Post subject: Re: Exakteres cout |
|
|
vegetables, and
fruit such as pineapples or cherries on the skewers.
Don?t be afraid to use a variety of meats.
Grill to medium rare,
serve with garlic cous-cous and sautéed asparagus.
Coffee and sherbet for desert then walnuts, cheese, and port.
Cigars for the gentlemen (and ladies if they so desire)!
Crock-Pot Crack Baby
When the quivering, hopelessly addicted crack baby succumbs to death,
get him immediately butchered and into the crock-pot, so that any
remaining toxins will not be fatal. But don?t cook it too long,
because like Blowfish, there is a perfect medium between the poisonous
and the stimulating. Though it may not have the same effect on your
guests, a whole chicken cooked in this fashion is also mighty tasty.
1 newborn - cocaine addicted, freshly expired, cleaned and butchered
Carrots
onions
leeks
celery
bell pepper
potatoes
Salt
pepper
garlic, etc
4 cups water
Cut the meat into natural pieces and brown very well in olive oil,
remove, then brown half of the onions, the bell pepper, and celery.
When brown, mix everything into the crock-pot, and in 6 to 8 hours you
have turned a hopeless tragedy into a heartwarming meal!
George?s Bloody Mary
Don?t shy away from this one, it is simply a cocktail variation of
good old Blood Stew. When a pig is killed, its throat is slit and
those present quaff a cup of hot blood to soften the wintry air.
From the dawn of man to this day, humans have always drunk blood!
American deer hunters are a prime example.
1 pint blood
Stolichnaya vodka
ice
tomato juice
lemon
lime
hot sauce
Worcestershire sauce
pickled green bean
celery
green olives
celery salt
Draw a pint of blood from a very young virgin,
|
|
| Back to top |
|
 |
kanze@gabi-soft.fr Guest
|
Posted: Sat Dec 25, 2004 11:27 pm Post subject: Re: Exakteres cout |
|
|
an additional 11 minutes.
Put the live babies into the boiling water and cover.
Boil till meat comes off easily with a fork.
Oven-Baked Baby-Back Ribs
Beef ribs or pork ribs can be used in this recipe,
and that is exactly what your dinner guests will assume!
An excellent way to expose the uninitiated to this highly misunderstood
yet succulent source of protein.
2 human baby rib racks
3 cups barbecue sauce or honey glaze (see index)
Salt
black pepper
white pepper
paprika
Remove the silverskin by loosening from the edges,
then stripping off.
Season generously, rubbing the mixture into the baby?s flesh.
Place 1 quart water in a baking pan, the meat on a wire rack.
Bake uncovered in 250° oven for 1½ hours.
When browned, remove and glaze,
return to oven and bake 20 minutes more to form a glaze.
Cut ribs into individual pieces and serve with extra sauce.
Fresh Sausage
If it becomes necessary to hide the fact that you are eating
human babies, this is the perfect solution.
But if you are still paranoid, you can substitute pork butt.
5 lb. lean chuck roast
3 lb. prime baby butt
2 tablespoons each:
salt
black, white and cayenne peppers
celery salt
garlic powder
parsley flakes
brown sugar
1 teaspoon sage
2 onions
6 cloves garlic
bunch green onions, chopped
Cut the children?s butts and the beef roast into pieces
that will fit in the grinder.
Run the meat through using a 3/16 grinding plate.
Add garlic, onions and seasoning then
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|