Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread safety #6

Open
IngwiePhoenix opened this issue Nov 30, 2014 · 3 comments
Open

Thread safety #6

IngwiePhoenix opened this issue Nov 30, 2014 · 3 comments

Comments

@IngwiePhoenix
Copy link

Hey.

So I am working with TinyThreads++ within my project and it will be vey easy to put it together with VFS. But, is thread-safety actually "implemented"? Like, if it was enabled, will it work? If not, then I will have to subclass most of the functions and manually implement lockign and unlocking...

Kind regards, Ingwie

@IngwiePhoenix
Copy link
Author

Decided to do a test...and ran into a compiler error, actually.

src/VFSHelper.cpp:360:23: error: invalid use of 'this' outside of a non-static member function
        VFS_GUARD_OPT(this);

The line itself is within a inline static method...so I don't know what th replace the this variable with to point to the correct object.

@fgenesis
Copy link
Owner

VFS_GUARD_OPT is gone in the newer dev version. It was "there, but never tested and risking to make people believe it worked was too dangerous to keep it in.
Just do external locking yourself if you have to. Other than that, MT file I/O is a pretty bad idea and you should avoid it if possible.

@IngwiePhoenix
Copy link
Author

Well I pretty much need to.

http://github.com/IngwiePhoenix/IceTea http://github.com/IngwiePhoenix/IceTea

It works its tasks on multiple threads, and part of that is organizing the output directory. Therefore I need to do I/O on multiple threads. ttvfs is the smallest library I could find for cross-platform I/O calls with possible MT support.

I just check out the newest dev branch and copied it into my project, so I need to add a few commits to get the latest state uploaded, including a header with approx. API calls.

I am going to run some testing using VFSAtomic.(h, cpp) and see if it works. if not, i will just have to move back into external locking...

Am 30.11.2014 um 17:23 schrieb False.Genesis [email protected]:

VFS_GUARD_OPT is gone in the newer dev version. It was "there, but never tested and risking to make people believe it worked was too dangerous to keep it in.
Just do external locking yourself if you have to. Other than that, MT file I/O is a pretty bad idea and you should avoid it if possible.


Reply to this email directly or view it on GitHub #6 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants