A MulleInvocationQueue is fed with NSInvocations, which it then executes in serial in a separate thread.
Release Version | Release Notes |
---|---|
RELEASENOTES |
The MulleThread is the combination of a NSConditionLock and NSThread.
The thread idles waiting for work. If there is something to do, you -nudge
the thread and it runs it's "target" / "selector". Then the thread returns
to idle, waiting for the next -nudge
.
MulleThread also manages a NSAutoreleasePool
for your code.
Create a thread and start it:
thread = [MulleThread mulleThreadWithTarget:foo
selector:@selector( runServer:)
object:nil];
[thread start];
The initial -start
will not call "target" / "selector" yet. The thread waits
for a -nudge
. You can -preempt
the thread at any time. For a more graceful
shutdown use -cancelWhenIdle
. The thread code can -cancel
itself at any
time. Use of +exit
to finish a "MulleThread" is bad style.
[thread nudge];
[thread preempt];
[thread cancelWhenIdle];
To wait for a thread to complete use -mulleJoin
. But you need to -preempt
or -cancelWhenIdle
before.
Requirement | Release Version | Description |
---|---|---|
MulleFoundationBase | 𧱠MulleFoundationBase amalgamates Foundations projects | |
mulle-objc-list | π Lists mulle-objc runtime information contained in executables. |
Use mulle-sde to add MulleThread to your project:
mulle-sde add github:MulleFoundation/MulleThread
Use mulle-sde to build and install MulleThread and all dependencies:
mulle-sde install --prefix /usr/local \
https://github.com/MulleFoundation/MulleThread/archive/latest.tar.gz
Install the requirements:
Requirements | Description |
---|---|
MulleFoundationBase | 𧱠MulleFoundationBase amalgamates Foundations projects |
mulle-objc-list | π Lists mulle-objc runtime information contained in executables. |
Download the latest tar or zip archive and unpack it.
Install MulleThread into /usr/local
with cmake:
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
-DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release
Nat! for Mulle kybernetiK