Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
Or Friedmann committed Aug 1, 2023
1 parent e38387e commit caba9b1
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions examples/speedb_is_awesome_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "rocksdb/db.h"
#include "rocksdb/options.h"
#include "rocksdb/env.h"

using ROCKSDB_NAMESPACE::DB;
using ROCKSDB_NAMESPACE::Options;
using ROCKSDB_NAMESPACE::ReadOptions;
Expand All @@ -28,27 +28,16 @@ std::string kDBPath = "C:\\Windows\\TEMP\\speedb_is_awesome_example";
#else
std::string kDBPath = "/tmp/speedb_is_awesome_example";
#endif
void f(std::thread::native_handle_type thr) {
#include "pthread.h"
std::cout << thr << std::endl;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(10, &cpuset);

int rc = pthread_setaffinity_np(thr,
sizeof(cpu_set_t), &cpuset);

}
int main() {
// Open the storage
DB* db = nullptr;
Options options;
options.cb = std::make_shared<std::function<void(std::thread::native_handle_type)>>(f);
// create the DB if it's not already present
options.create_if_missing = true;
Status s = DB::Open(options, kDBPath, &db);
assert(s.ok());
while(true) {

// append new entry
std::string key = "key_1";
std::string put_value = "Speedb is awesome!";
Expand All @@ -61,7 +50,7 @@ int main() {
assert(s.ok());
assert(get_value == put_value);
std::cout << get_value << std::endl;
}

// close DB
s = db->Close();
assert(s.ok());
Expand Down

0 comments on commit caba9b1

Please sign in to comment.