Closed sierret closed 1 year ago
FIXED: moved code inside main. I was using a header file to declare global vars. Still, perhaps you could still look into this undefined behaviour(as I call it), as the docs certainly didn't require a template for set::lock.
Thanks for your time nevertheless.
If I understand correctly and from your code snippet above
using MyDataFrame = StdDataFrame;
is not a well-defined type, because StdDataFrame
requires one mandatory template argument -- index type. So you need something like:
using MyDataFrame = StdDataFrame<long>;
to be will-defined
I still don't see a type!
I understand.
I used the exact line you typed but I realise now everytime I type it in and hit Comment, the type and the angle brackets gets removed from the posted comment. I don't know why, it may have to do with my Grammarly addon. But I did indeed use the exact like you outlined with the type in the angle brackets and still no dice.
To clarify, I did indeed use
using MyDataFrame = StdDataFrame[int];
//assume [] are angle brackets because I have no idea why Github won't let me comment using that
Yet, I still received this error.
and how did you fix it? by moving the code from header file to a .cc file?
I moved only the line
`MyDataFrame::set_lock(&lock);
from` header file to main() in .cpp file. The rest of the code above stayed in the header file that I include at the top of the .cpp file.
Also, to clarify, since the set_lock is static, the lock can be set after the MyDataFrame df is declared and also works across all instances of MyDataFrame?
correct
Hi. I'm using this in a multi-threaded environment and was trying to use the locks you built in/included out of the box but I get an error(in the title). I'm also trying to use the lock as a global variable if that makes a difference for access across multiple files if that makes a difference although I doubt it does.
The idea is I'm trying to protect the df in a multi-threaded environment. I'm assuming spinlock is suitable.
Code looks like:
using namespace hmdf; using MyDataFrame = StdDataFrame[int];
SpinLock lock; MyDataFrame::set_lock(&lock); MyDataFrame df;
If column types are needed, df will be populated with columns in order: int(index col),double,float,float,float. Thanks in advance for any assistance.
Additionally, kindly, please consider adding basic SpinLock/SpinGuard/etc lock usage examples to docs so users don't have to dig through source code. That's very user-unfriendly to beginners.
UPDATE: fixed - see comment below