Skip to content

Instantly share code, notes, and snippets.

View aferust's full-sized avatar
💭
I may be slow to respond.

Ferhat Kurtulmuş aferust

💭
I may be slow to respond.
  • Bursa
View GitHub Profile
import core.stdc.stdio;
import core.sys.windows.windows;
struct UserData {
int data;
}
extern (Windows) uint t1(void* data) {
auto tid = GetCurrentThreadId();
auto dt = *(cast(UserData*)data);
@aferust
aferust / gist:898a96fdfe23e72ce14685c7e0250e56
Last active September 23, 2023 21:44
BetterC threadpool
// WIP
import dvector;
import deimos.uv;
struct UVThread {
alias CBDelegate = void delegate(void*, void*) @nogc nothrow;
alias CBFunPtr = void function(void*, void*) @nogc nothrow;
import core.stdc.stdio;
import bindbc.nanovg;
import bindbc.glfw;
import bindbc.opengl;
@nogc nothrow:
int initNanovg(){
version(BindNanovg_Static){
module app;
import std.conv;
import std.process;
import beamui;
mixin RegisterPlatforms;
int main()
@aferust
aferust / dlang tcp server
Created September 24, 2020 11:24
dlang tcp server
import std.stdio;
import std.socket;
class TCPServer{
string host;
ushort port;
@disable this();
@aferust
aferust / main.d
Created September 27, 2020 10:39
delayed control signal
import core.thread;
import std.stdio;
import std.concurrency;
import std.container.dlist;
import std.datetime;
import std.datetime.systime;
__gshared DList!Entry queue;
__gshared bool shouldRun = true;
@aferust
aferust / main.d
Last active September 27, 2020 14:03
delayed ctrl 2
import std.stdio;
import std.concurrency;
import core.thread;
void main() {
int k;
while(true){
auto childTid = spawn(&spawnedFunc, thisTid);
Thread.sleep(10.msecs);
send(childTid, k);
@aferust
aferust / sample.txt
Created October 8, 2020 19:54
GtkD threads
apd.d :
module app;
import std.stdio;
import std.experimental.logger: trace;
import gio.Application : GApplication = Application;
import gtk.Main;
import gtk.Application;
@aferust
aferust / sample2.d
Last active October 20, 2020 20:25
module app;
import std.stdio;
import std.experimental.logger: trace;
import std.conv;
import gio.Application : GApplication = Application;
import gtk.Main;
import gtk.Application;
@aferust
aferust / main.d
Last active October 22, 2020 20:54
addressing general tree
/+
0
/ | \
1 2 3
/ \ / | \
4 5 6 7 8
address(0) = [] // root
address(1) = [0] // root.children[0]
address(2) = [1] // etc