flygun

AsyncSQL with std::mutex and std::thread

8 posts in this topic

I edited Async Class to use C++ Standard mutex and thread support

AsyncSQL.h

ASyncSQL.cpp

 

plus if you have this line in main.cpp inside the main function inside the db core source delete it 

DBManager.Quit();

this line will close MySQL connections  before making sure that all the queries are done (which may not save the last thing a player do before closing the server) plus it will dump a core file since the db core will abort without successful exit! 

 

#edited

  • Using std::gurad (which unlock the mutex when the object is destroyed) instead of manually lock and unlock mutex 
  • rewrote the Profiler class with std::chrono 

#Note : Don't  just copy and paste .. make a backup , test , then use it

Best regards.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
12 minutes ago, martysama0134 said:

AsyncSQL.h

This page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff.
 

sorry i edited the file after putting the link .. didn't thought that the link will change!
thanks for noticing 

Share this post


Link to post
Share on other sites

You can edit a little more, I think it will look better.

 

Use nullptr instead of NULL

Please stop usage header guards in 2019, go for pragma once

Use smart pointers instead of raw pointers

Use lock_guard instead of lock manually everytime

Clear dirty korean commands, unused veriables etc.

 

Anyway thanks for publishing.

  • Like 1

Share this post


Link to post
Share on other sites
15 minutes ago, Koray said:

You can edit a little more, I think it will look better.

 

Use nullptr instead of NULL

Please stop usage header guards in 2019, go for pragma once

Use smart pointers instead of raw pointers

Use lock_guard instead of lock manually everytime

Clear dirty korean commands, unused veriables etc.

 

Anyway thanks for publishing.

i'll rewrite the whole file today or tomorrow maximum .. i just wanted to see if actually someone want it ... 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.