This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
@class connection connection.h | |
@author Jeremy Thornton http://libfbp.blogspot.co.uk/ | |
@copyright Copyright (c) 2013 Jeremy Thornton - MIT License http://opensource.org/licenses/MIT | |
@version 0.5 | |
@since 0.1 | |
*/ | |
#ifndef fbp_connection_h | |
#define fbp_connection_h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "component.h" | |
namespace fbp { | |
component* component::operator()() { | |
try { | |
return run(); | |
} | |
catch (que::queue_closed_exception) { | |
return finally(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef CPU_RELAX_H | |
#define CPU_RELAX_H | |
#include <intrin.h> | |
namespace sync { | |
inline static void cpu_relax() { | |
#if (COMPILER == MVCC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MCS_LOCK_H | |
#define MCS_LOCK_H | |
#include <cstdint> | |
#include <assert.h> | |
#include <atomic> | |
#include <thread> | |
#include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mcs_lock.h" | |
namespace sync { | |
void mcs_lock::lock() { | |
//to acquire the lock a thread atomically appends its own local node at the tail of the list returning tail's previous contents | |
auto prior_node = tail.exchange(&local_node, | |
std::memory_order_acquire); | |
if(prior_node != nullptr) { | |
local_node.locked = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief stopwatch idiom high precision timer for measuring software performance | |
* @tparam PolicyClock - std::chrono::steady_clock (default), system_clock, high_resolution_clock | |
*/ | |
template<typename PolicyClock = std::chrono::steady_clock> | |
class stopwatch { | |
using clock_t = PolicyClock; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <variant> | |
#include <string> | |
#include <vector> | |
#include <unordered_map> | |
#include <iostream> | |
#include <iomanip> | |
#include <sstream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the data frame. | |
emp.data <- data.frame( | |
emp_id = c (1:5), | |
emp_name = c("Rick","Dan","Michelle","Ryan","Gary"), | |
salary = c(623.3,515.2,611.0,729.0,843.25), | |
start_date = as.Date(c("2012-01-01", "2013-09-23", "2014-11-15", "2014-05-11", | |
"2015-03-27")), | |
stringsAsFactors = FALSE | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "r_data_frame.h" | |
int main() { | |
std::cout << "heterogeneous container\n\n"; | |
R::data_frame d; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heterogeneous container | |
id name salary start_date | |
0 1 Rick 623.3 2012-01-01 | |
1 2 Dan 515.2 2013-09-23 | |
2 3 Michelle 611 2014-11-15 | |
3 4 Ryan 729 2014-05-11 | |
4 5 Gary 843.25 2015-03-27 | |
Dan earns $515.2 |
OlderNewer