Skip to content

MulleFoundation/MulleThread

Repository files navigation

MulleThread

🍝 MulleThread sleeps until nudged

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

Release Version Release Notes AI Documentation
Mulle kybernetiK tag Build Status RELEASENOTES DeepWiki for MulleThread

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
MulleObjC Mulle kybernetiK tag Build Status πŸ’Ž A collection of Objective-C root classes for mulle-objc
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 MulleThread to your project:

mulle-sde add github:MulleFoundation/MulleThread

Install

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

Legacy Installation

Install the requirements:

Requirements Description
MulleObjC πŸ’Ž A collection of Objective-C root classes for mulle-objc
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:

PREFIX_DIR="/usr/local"
cmake -B build                               \
      -DMULLE_SDK_PATH="${PREFIX_DIR}"       \
      -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}" \
      -DCMAKE_PREFIX_PATH="${PREFIX_DIR}"    \
      -DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release

Author

Nat! for Mulle kybernetiK

About

🍝 MulleThread sleeps until nudged

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •