Wednesday, March 8, 2017

Digest for comp.lang.c++@googlegroups.com - 2 updates in 2 topics

Christopher <christopherpisz@gmail.com>: Mar 08 02:57PM -0800

I debugged an application to the following scenario:
 
 
#include <mutex>
 
std::mutex g_mutex;
 
int main()
{
 
std::unique_lock<std::mutex> lock(g_mutex);
lock.release();
lock.lock();
lock.release();
}
 
 
This throws on the second attempt to lock.
I thought the difference between unique lock and lock guard was that unique lock allowed manually locking and unlocking. We cannot lock it twice?
Mike Copeland <mrc2323@cox.net>: Mar 08 02:56PM -0700

In article <o9pt5l$f6j$1@dont-email.me>,
alf.p.steinbach+usenet@gmail.com says...
 
> It seems that for BNoffset you want it to get the index of the last
> occurrence of "NO." or "BIB" in the array.
 
> Is this correct, and if so, what do you use that for?
 
No, that's not quite what I'm doing. I'm processing a CSV file that
has a reader record (the constants). I want to determine the offset for
each data field in data record so that I know how to process the data
values. For example, if Column 2 has the "BIB" values, I want to
process that data with a routine that's coded for whatever the
"BNoffset" index is for that file. That is, when I process the "Bib#"
field data, I need to know that the data for that processing is in the
2nd field in the data records.
Furthermore, the "Bib#" field can be identified in various files by
"NO.", "BIB", or other header names. So, for each fiel's processing I
need to scan the header, determine which columns have the data values I
want to process, and be able to access the data from a parsed CSV
records.
So, as I scan the header record, as I find a match on specific
constant values, I want to save the column offset in the named offset
values (BNoffset, OPoffset, FNoffset, etc.). There are many fields and
even more field names, and any field can be in any column of the file.
8<{{
Does this help?
 
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: