Skip to content

๐Ÿšถ๐Ÿšถ๐Ÿšถ MulleInvocationQueue runs code in a separate thread

License

Notifications You must be signed in to change notification settings

MulleFoundation/MulleInvocationQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MulleInvocationQueue

๐Ÿšถ๐Ÿšถ๐Ÿšถ MulleInvocationQueue runs code in a separate thread

A MulleInvocationQueue is fed with NSInvocations, which it then executes in serial in a separate thread.

Release Version Release Notes
Mulle kybernetiK tag Build Status RELEASENOTES

MulleThread

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.

Requirements

Requirement Release Version Description
MulleThread Mulle kybernetiK tag Build Status ๐Ÿ MulleThread sleeps until nudged
MulleFoundationBase Mulle kybernetiK tag Build Status ๐Ÿงฑ MulleFoundationBase amalgamates Foundations projects
mulle-objc-list Mulle kybernetiK tag Build Status ๐Ÿ“’ Lists mulle-objc runtime information contained in executables.

You are here

Overview

Add

Use mulle-sde to add MulleInvocationQueue to your project:

mulle-sde add github:MulleFoundation/MulleInvocationQueue

Install

Install with mulle-sde

Use mulle-sde to build and install MulleInvocationQueue and all dependencies:

mulle-sde install --prefix /usr/local \
   https://github.com/MulleFoundation/MulleInvocationQueue/archive/latest.tar.gz

Manual Installation

Install the requirements:

Requirements Description
MulleThread ๐Ÿ MulleThread sleeps until nudged
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 MulleInvocationQueue 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

Author

Nat! for Mulle kybernetiK

About

๐Ÿšถ๐Ÿšถ๐Ÿšถ MulleInvocationQueue runs code in a separate thread

Resources

License

Stars

Watchers

Forks

Packages

No packages published