coderstephen
163ffb4f54
Add spawn shortcut for threads
2015-08-21 22:39:56 -05:00
Stephen Coakley
30882e456b
Merge pull request #1 from icicleio/thread-inherit-all
...
Inherit the environment when spawning a new thread
2015-08-20 21:26:49 -05:00
coderstephen
fed8de64aa
Passing autoloader to child no longer necessary
2015-08-20 16:21:09 -05:00
coderstephen
dd38cd1142
Autoload behaves consistently with pthreads 2.0.11
2015-08-20 14:40:44 -05:00
coderstephen
33ce561135
New Parcel interface for shared objects
2015-08-20 14:13:01 -05:00
coderstephen
55c9479799
A simple container for thread sharing
...
Uses a ThreadedMutex to provide synchronization methods on the container.
2015-08-19 15:56:00 -05:00
coderstephen
d90ae70c22
Inherit all from parent and handle loader in child
2015-08-19 10:59:55 -05:00
Aaron Piotrowski
8c09c16204
Refine channel implementation
2015-08-18 19:12:58 -05:00
Aaron Piotrowski
36725728aa
Add locks to thread context
2015-08-18 10:12:06 -05:00
coderstephen
b60f47424a
Bring in sample worker API from old branch
2015-08-14 12:25:07 -05:00
coderstephen
d2ab1cd0a1
First working async POSIX semaphore using shared objects
2015-08-10 22:27:10 -05:00
Aaron Piotrowski
feb620fdea
Refactor threading / simplify contexts
2015-08-10 17:38:58 -05:00
coderstephen
6c8898b416
Some cleanup, with persistent permissions and better resize handling
2015-08-10 16:36:01 -05:00
coderstephen
d8edf495ec
Merge branch 'master' of github.com:icicleio/concurrent
2015-08-10 13:21:32 -05:00
coderstephen
4de9909c00
Fix bugs with deref() and use set() instead of update()
2015-08-10 13:21:22 -05:00
Aaron Piotrowski
6f657e889e
Refactor ThreadedSemaphore and ThreadedMutex
2015-08-09 22:30:11 -05:00
coderstephen
b0ebadedf6
New shared memory object that stores a single value
2015-08-09 22:16:34 -05:00
coderstephen
df5db8ac4e
Make destroying ThreadedMutex explicit
2015-08-07 23:30:48 -05:00
coderstephen
ed34e1e5d9
Remove unneeded mutex and semaphore implementations
2015-08-07 23:13:33 -05:00
coderstephen
f109bd926f
Update FileMutex to be async
2015-08-07 23:12:21 -05:00
coderstephen
35bdedf390
Add a thread-safe mutex and update MutexInterface to be non-blocking
2015-08-07 22:45:41 -05:00
Aaron Piotrowski
ed08c738d5
Use array instead of SplQueue
2015-08-07 20:19:34 -05:00
coderstephen
eb91972489
Merge branch 'master' of github.com:icicleio/concurrent
2015-08-07 15:32:39 -05:00
coderstephen
000de5ba12
New threaded async semaphore, with a better semaphore API
2015-08-07 15:32:18 -05:00
Aaron Piotrowski
1b77f37693
Add executor contexts, bind to executors instead of channel
2015-08-07 15:30:14 -05:00
coderstephen
50444e41e3
Move all semaphores to Sync namespace
2015-08-07 13:23:33 -05:00
Aaron Piotrowski
078f915081
Rebind $this to channel
2015-08-07 00:07:53 -05:00
Aaron Piotrowski
dc3cd5155e
Add ability to pass arguments to context function
2015-08-06 23:25:04 -05:00
coderstephen
4d90dc5ca7
Merge channel changes
2015-08-06 22:24:45 -05:00
Aaron Piotrowski
399764f7b9
Remove file_exists() check
2015-08-06 21:51:45 -05:00
Aaron Piotrowski
c34d1331af
Fix exit error messages
2015-08-06 20:56:30 -05:00
Aaron Piotrowski
4ca84144b0
Update and fix forking code
2015-08-06 20:54:57 -05:00
Aaron Piotrowski
c52ec19a38
Refactor contexts and exiting
2015-08-06 18:59:25 -05:00
Aaron Piotrowski
b5d97eb9d5
Fix reading from channel
2015-08-05 21:13:29 -05:00
Aaron Piotrowski
43d4b53ac2
Fix reading from channel
2015-08-05 18:48:20 -05:00
coderstephen
09edc25348
Add more to docs
2015-08-05 16:00:29 -05:00
coderstephen
d95ee80cb8
Faster object ID selection
2015-08-05 15:44:53 -05:00
coderstephen
1ece940057
Fix channel coroutines to yield correct values
2015-08-05 13:30:05 -05:00
coderstephen
641946e3a8
Update context interface with create method and clean up ThreadContext
2015-08-05 13:29:11 -05:00
coderstephen
865979188c
Copy global parameters and environment values to threads
2015-08-05 12:41:37 -05:00
coderstephen
63ad35cec1
Remove unused exception type
2015-08-05 11:36:37 -05:00
coderstephen
ab32b4b88e
More docs
2015-08-05 11:35:42 -05:00
coderstephen
3855d8b5e9
Add handling for cloning local objects
2015-08-05 11:19:48 -05:00
coderstephen
cac4bdf71e
Use LocalObject to store local storage array
2015-08-05 03:45:35 -05:00
coderstephen
f648c5febb
Make sure object ID is unique
2015-08-05 02:52:45 -05:00
coderstephen
ff413c904c
First working, async threads using channels for messages
...
Channel was changed to return resources on creation.
Also, much better setting up synchronization at the beginning of a new
thread.
2015-08-05 02:48:43 -05:00
coderstephen
ced3ddc8ff
New class for storing non-thread-safe objects in thread-local memory
2015-08-05 02:21:49 -05:00
coderstephen
a372328534
LocalStorage class for storing unsafe data inside a thread
2015-08-03 16:07:58 -05:00
coderstephen
e2577a6ab1
Update docs
2015-08-03 15:11:58 -05:00
coderstephen
5cd8353fcc
Store panic info inside an error
2015-08-03 15:11:27 -05:00
coderstephen
b9cef10633
Add panic method for panicking a context from either side
2015-08-03 15:10:59 -05:00
coderstephen
c110d4baa6
Use Channel for fork messages
2015-08-03 15:08:27 -05:00
coderstephen
7919a0df38
Add better socket checking and error handling
...
Also update send() to return a generator.
2015-08-03 01:22:17 -05:00
coderstephen
f121adb577
Get rid of coroutine wrapper
2015-08-03 00:58:08 -05:00
coderstephen
db5469a9cf
Exception for channels
2015-08-03 00:29:41 -05:00
coderstephen
72db6e53aa
Fix dumb mistakes and add close() method
2015-08-03 00:19:51 -05:00
coderstephen
ee6b8e1ec1
Ported message passing to channel class
2015-08-02 23:45:31 -05:00
coderstephen
ae23b0adba
Fix method names
2015-08-02 17:56:25 -05:00
coderstephen
ff2f0682d6
Add semaphore from sync extension
2015-08-01 21:56:18 -05:00
coderstephen
19080f651b
Add interface for synchronous semaphores
2015-08-01 21:51:45 -05:00
coderstephen
9b63e7fe7d
A mutex based on the sync extension
2015-08-01 21:18:14 -05:00
coderstephen
cf788a9377
Add portable mutex using flock()
2015-08-01 21:07:33 -05:00
coderstephen
eded7b86a4
Use a common interface for mutexes
2015-08-01 20:15:03 -05:00
coderstephen
a0d0b3646e
Add a thread-safe mutex
2015-08-01 20:02:57 -05:00
coderstephen
92432ff58b
Experimental closure-based contexts
2015-07-26 17:53:00 -05:00
coderstephen
9337d3a8ea
Fix bug where shared data would sometimes disappear
2015-07-15 18:36:42 -05:00
coderstephen
1f76fcadb2
Synchronization methods now part of SynchronizableInterface
2015-07-15 18:12:18 -05:00
coderstephen
1ed1a45a3d
Fix pending locks not handled bug
2015-07-15 18:11:05 -05:00
coderstephen
72f767b707
Fix docblock goof
2015-07-15 17:31:04 -05:00
coderstephen
6442bb9191
Don't recursively create thread instances
2015-07-15 12:36:32 -05:00
coderstephen
46d18480a4
Add some comments and docblocks
2015-07-15 11:24:04 -05:00
coderstephen
2eff29d036
Allow any callable inside synchronized() calls
2015-07-14 23:47:21 -05:00
coderstephen
3c4448866f
Run given ThreadContext::run() inside thread
2015-07-14 17:15:10 -05:00
coderstephen
18b7c68f65
Experimental pthread context
2015-07-13 17:30:59 -05:00
coderstephen
f1b681537f
Async synchronized object
2015-07-13 17:30:14 -05:00
coderstephen
f9d57e7d8f
ContextInterface now returns promises for locking
2015-07-13 12:28:14 -05:00
coderstephen
a288e99287
Split Synchronized into SharedObject and integrate async locking
...
Synchronized has now been split into SharedObject, and a subclass Synchronized. AsyncSemaphore now extends SharedObject and uses a sync semaphore manually as gatekeeper, and Synchronized now uses an async semaphore for locking.
2015-07-13 12:26:37 -05:00
coderstephen
6f185ad17d
Handle signals inside AsyncSemaphore
2015-07-12 15:57:04 -05:00
coderstephen
24a1e2fc8f
Move special values to constants
2015-07-11 12:07:31 -05:00
coderstephen
277e5ded02
Synchronize using shmop and docblock annotations
2015-07-11 05:01:36 -05:00
coderstephen
fefa5e706a
Prototypal asynchronous semaphore
2015-07-10 23:13:24 -05:00
coderstephen
b0e19519d0
Fix semaphores sometimes not removed after termination
2015-07-10 18:24:58 -05:00
coderstephen
e9f09077c9
More appropriate method names
2015-07-10 17:48:50 -05:00
coderstephen
8dd597238d
Semaphore handles can be serialized across contexts
2015-07-10 16:17:18 -05:00
coderstephen
2c40e0ddcb
Restructure exceptions
2015-07-10 16:16:24 -05:00
coderstephen
e257109ad1
Rename Context to ContextInterface
2015-07-10 16:07:52 -05:00
coderstephen
99873cc74c
Only call reInit() in forked process
2015-07-10 15:53:57 -05:00
coderstephen
12a7f75a16
Fix wrong class name
2015-07-10 13:34:40 -05:00
coderstephen
6fc6b6f893
Always unlock even after exceptions and better exceptions thrown
2015-07-10 11:59:38 -05:00
coderstephen
1698aeefcf
Rename Synchronizable to Synchronized and move locking to Synchronized
...
The ability to call synchronized functions now belongs to any Synchronized object.
2015-07-10 11:23:20 -05:00
coderstephen
27549c5c9c
Update fork context to support synchronization and asynchronous join
2015-07-10 02:23:08 -05:00
coderstephen
3a30fa1d4c
Context interface now synchronizes synchronously and joins asynchronously
2015-07-10 02:22:04 -05:00
coderstephen
40f0ca220e
Add semaphore exception type
2015-07-10 02:20:52 -05:00
coderstephen
e435ace0af
Add atomic, UNIX-compatible semaphore class
2015-07-10 02:20:34 -05:00
coderstephen
64b429ce25
Another working setup using local UNIX socket pairs for speed
2015-07-09 13:13:20 -05:00
coderstephen
6cf368d3dd
Add some really simple working code using forks and sockets
2015-07-09 01:35:34 -05:00