Commit Graph

28 Commits (833477abf5a7df2c8861a2df11fae2105016e087)

Author SHA1 Message Date
Andrew Kelley 821805aa92 WIP: Channel.getOrNull 2018-08-02 17:04:17 -04:00
Andrew Kelley e3ae2cfb52 add std.event.RwLock and a few more std changes
* add std.event.RwLock and std.event.RwLocked
 * std.debug.warn does its printing locked
 * add std.Mutex, however it's currently implemented as a spinlock
 * rename std.event.Group.cancelAll to std.event.Group.deinit and change
   the docs and assumptions.
 * add std.HashMap.clone
2018-08-01 16:26:37 -04:00
Andrew Kelley cc45527333 introduce std.event.fs for async file system functions
only works on linux so far
2018-07-30 13:44:36 -04:00
Andrew Kelley 30c4add85a std.event.Future: workaround in tests for llvm coro memory
See #1194
2018-07-11 20:17:47 -04:00
Andrew Kelley 9bdcd2a495 add std.event.Future
This is like a promise, but it's for multiple getters, and
uses an event loop.
2018-07-11 16:00:06 -04:00
Andrew Kelley 8fba0a6ae8 introduce std.event.Group for making parallel async calls 2018-07-10 15:17:01 -04:00
Andrew Kelley b6eb404831 organize std.event into directories 2018-07-09 22:22:44 -04:00
Andrew Kelley c89aac85c4 better workaround for guaranteeing memory in coroutine frame
See #1194
2018-07-09 21:21:59 -04:00
Andrew Kelley 1a1534ecb5 fix regression on macos 2018-07-09 17:16:06 -04:00
Andrew Kelley 9462852433 std.event.Loop multithreading for windows using IOCP 2018-07-09 16:49:46 -04:00
Andrew Kelley caa0085057 implement std.os.cpuCount for windows 2018-07-09 13:19:11 -04:00
Andrew Kelley 3ba451778f fix regressions on linux 2018-07-09 01:22:36 -04:00
Andrew Kelley 50d70d5f49 tests passing with kqueue on macos 2018-07-08 02:46:10 -04:00
Andrew Kelley c15a6fa9d0 add std.os.cpuCount and have std.event.Loop use it for thread pool size 2018-07-07 01:23:18 -04:00
Andrew Kelley 57f36c4201 std.event.Loop: use EPOLLONESHOT to save 1 syscall
when a thread pool worker accepts a coroutine to resume
2018-07-07 00:32:19 -04:00
Andrew Kelley eb326e1553 M:N threading
* add std.atomic.QueueMpsc.isEmpty
 * make std.debug.global_allocator thread-safe
 * std.event.Loop: now you have to choose between
   - initSingleThreaded
   - initMultiThreaded
 * std.event.Loop multiplexes coroutines onto kernel threads
 * Remove std.event.Loop.stop. Instead the event loop run() function
   returns once there are no pending coroutines.
 * fix crash in ir.cpp for calling methods under some conditions
 * small progress self-hosted compiler, analyzing top level declarations
 * Introduce std.event.Lock for synchronizing coroutines
 * introduce std.event.Locked(T) for data that only 1 coroutine should
   modify at once.
 * make the self hosted compiler use multi threaded event loop
 * make std.heap.DirectAllocator thread-safe

See #174

TODO:
 * call sched_getaffinity instead of hard coding thread pool size 4
 * support for Windows and MacOS
 * #1194
 * #1197
2018-07-07 00:32:19 -04:00
Andrew Kelley 96a6bc57d2 modify std.event.Loop to work for windows and macos 2018-07-02 14:38:11 -04:00
Andrew Kelley a3f55aaf34 add event loop Channel abstraction
This is akin to channels in Go, except:
 * implemented in userland
 * they are lock-free and thread-safe
 * they integrate with the userland event loop

The self hosted compiler is changed to use a channel for events,
and made to stay alive, watching files and performing builds when
things change, however the main.zig file exits after 1 build.

Note that nothing is actually built yet, it just parses the input
and then declares that the build succeeded.

Next items to do:
 * add windows and macos support for std.event.Loop
 * improve the event loop stop() operation
 * make the event loop multiplex coroutines onto kernel threads
 * watch source file for updates, and provide AST diffs
   (at least list the top level declaration changes)
 * top level declaration analysis
2018-07-02 14:38:11 -04:00
Andrew Kelley ec1b6f6673
breaking syntax change: ??x to x.? (#1095)
See #1023

This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Andrew Kelley fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley ea58f4a5a9 run zig fmt on the codebase 2018-05-30 16:09:11 -04:00
Andrew Kelley b184ae5ca5 run zig fmt on some of the codebase
See #1003
2018-05-26 23:00:29 -04:00
Andrew Kelley 43085417be update github.com/zig-lang to github.com/ziglang 2018-05-24 21:27:44 -04:00
Andrew Kelley 4787127cf6 partial conversion to post-fix pointer deref using zig fmt 2018-05-10 00:29:49 -04:00
Andrew Kelley e85a10e9f5 async tcp server proof of concept 2018-04-09 00:52:45 -04:00
Andrew Kelley cbda0fa78c basic tcp server working when used with netcat 2018-04-08 20:08:40 -04:00
Andrew Kelley b85ef656ca running into the llvm corosplit error again 2018-04-08 18:30:54 -04:00
Andrew Kelley 0d22a00f6f *WIP* async/await TCP server 2018-04-08 18:26:24 -04:00