Skip to content

Instantly share code, notes, and snippets.

View Syntaf's full-sized avatar
🚄
Rails Enthusiast

Grant Mercer Syntaf

🚄
Rails Enthusiast
View GitHub Profile
CREATE OR REPLACE PROCEDURE
# stuff
IS
# local vars
BEGIN
#code
END;
/
Hi <>!
I am in the process of building a free site for slackliners, and am contacting you because you are an admin of <>. My site will allow users to view where certain slackline groups are on a map, and I need help from someone to draw where this group operates.
I've already filled out the rest of the groups information, so if you'd like to lend a hand, you only need to draw on my map where the group is. Please let me know if you have any questions and thank you for any help you can offer!
edit link:
username: group-admin
password: slacklife
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
// ....
std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
auto time_span = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1);
var app = angular.module('OutboxApp', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
controller: 'HomeController',
templateUrl: 'views/home.html'
})
.when('/outbox/:id', {
controller: 'EmailController',

Linux provides a sys_futex() system call to assist in implementing hybrid user-level/kernal-level locks and condition variables.

A call to long sys_futex(void* addr1, FUTEX_WAIT, int val1, NULL, NULL, 0) checks to see if the memory at address addr1 has the same value as val1. If so, the calling thread is suspended. If not, the calling thread returns immedietely with the error return value EWOULDBLOCK. In addition, the system call returns with the value EINTR if the thread receives a signal.

A call to long sys_futex(void *addr1, FUTEX_WAKE, 1, NULL, NULL, 0) causes one thread waiting on addr1 to return

Consider the following simple implementation of a hybrid user-level/kernal-level lock.

class TooSimpleFutexLock {
return hpx::lcos::local::dataflow(
[&errors, &workitems](std::vector<hpx::future<void> > && r)
mutable -> void
{
util::detail::handle_local_exceptions<ExPolicy>::call(
workitems, errors);
return;
},
std::move(workitems));
[ 4%] Built target hpx_init
[100%] Built target hpx
Scanning dependencies of target make_heap_test_exe
[100%] Building CXX object tests/unit/parallel/algorithms/CMakeFiles/make_heap_test_exe.dir/make_heap.cpp.o
In file included from /home/ghome/Github/fork_hpx/repo/hpx/include/parallel_make_heap.hpp:9:0,
from /home/ghome/Github/fork_hpx/repo/tests/unit/parallel/algorithms/make_heap.cpp:8:
/home/ghome/Github/fork_hpx/repo/hpx/parallel/algorithms/make_heap.hpp: In instantiation of ‘static typename hpx::parallel::util::detail::algorithm_result<ExPolicy, void>::type hpx::parallel::v1::detail::make_heap<RndIter>::parallel(ExPolicy, RndIter, RndIter, Pred&&) [with ExPolicy = hpx::parallel::v1::parallel_execution_policy; Pred = std::less<long unsigned int>; RndIter = test::test_iterator<__gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int> >, std::random_access_iterator_tag>; typename hpx::parallel::util::detail::algorithm_result<ExPolicy, void>::type = void]’:
/home/ghome
// bind sift_down_range and it's parameters to op
auto op =
hpx::util::bind(
&sift_down_range<RndIter, Pred>, first,
std::forward<Pred>(pred), n, first + start - cnt,
chunk_size);
// call async_execute with the bound function
workitems.push_back(
executor_traits::async_execute(
#include <hpx/lcos/local/composable_guard.hpp>
#include <hpx/util/bind.hpp>
#include <hpx/hpx_init.hpp>
#include <iostream>
void incr(int &il1) {
il1 = il1 + 1;
}
hpx::lcos::local::guard l1;