<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/CThread?action=history&amp;feed=atom</id>
	<title>CThread - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/CThread?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CThread&amp;action=history"/>
	<updated>2026-05-08T16:05:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=45963&amp;oldid=prev</id>
		<title>Qaisjp: fix newline</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=45963&amp;oldid=prev"/>
		<updated>2015-09-13T01:29:17Z</updated>

		<summary type="html">&lt;p&gt;fix newline&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:29, 13 September 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;lowercasetitle/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;lowercasetitle/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class implements the lua coroutines and can be used to limit method calls to a specific amount / second.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class implements the lua coroutines and can be used to limit method calls to a specific amount / second.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This can be very useful when loading big amounts of data on gamemode startup to avoid an infinite running script and termination.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This can be very useful when loading big amounts of data on gamemode startup to avoid an infinite running script and termination.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-44731:rev-45963 --&gt;
&lt;/table&gt;</summary>
		<author><name>Qaisjp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44731&amp;oldid=prev</id>
		<title>MuLTi at 18:37, 23 February 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44731&amp;oldid=prev"/>
		<updated>2015-02-23T18:37:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:37, 23 February 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Useful Class}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Useful Class}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Needs_Example}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;lowercasetitle/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;lowercasetitle/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-44730:rev-44731 --&gt;
&lt;/table&gt;</summary>
		<author><name>MuLTi</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44730&amp;oldid=prev</id>
		<title>MuLTi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44730&amp;oldid=prev"/>
		<updated>2015-02-23T18:35:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:35, 23 February 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l9&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Requirements==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Requirements==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;No requirements&lt;/del&gt;''&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Knowledge&lt;/ins&gt;''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Code==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Code==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-44728:rev-44730 --&gt;
&lt;/table&gt;</summary>
		<author><name>MuLTi</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44728&amp;oldid=prev</id>
		<title>MuLTi: Created page with &quot;{{Useful Class}} {{Needs_Example}} &lt;lowercasetitle/&gt; __NOTOC__  This class implements the lua coroutines and can be used to limit method calls to a specific amount / second. T...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CThread&amp;diff=44728&amp;oldid=prev"/>
		<updated>2015-02-23T18:33:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Class}} {{Needs_Example}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__  This class implements the lua coroutines and can be used to limit method calls to a specific amount / second. T...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Class}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
This class implements the lua coroutines and can be used to limit method calls to a specific amount / second.&lt;br /&gt;
This can be very useful when loading big amounts of data on gamemode startup to avoid an infinite running script and termination.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
''No requirements''&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--&lt;br /&gt;
-- Created by IntelliJ IDEA.&lt;br /&gt;
-- User: Noneatme&lt;br /&gt;
-- Date: 25.01.2015&lt;br /&gt;
-- Time: 14:33&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
cThread = {}&lt;br /&gt;
cThread.__index     = cThread;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Threads     = {}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function cThread:new(...)&lt;br /&gt;
    local obj = setmetatable({}, {__index = self});&lt;br /&gt;
    if obj.constructor then&lt;br /&gt;
        obj:constructor(...);&lt;br /&gt;
    end&lt;br /&gt;
    return obj;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cThread:constructor(sName, func, iAmmounts)&lt;br /&gt;
    assert(Threads[sName] == nil);&lt;br /&gt;
    self.name = sName&lt;br /&gt;
    self.func = func&lt;br /&gt;
&lt;br /&gt;
    self.iAmmounts = iAmmounts or 1;&lt;br /&gt;
--  outputConsole(&amp;quot;[TRHEAD: &amp;quot;..sName..&amp;quot;] Constructor&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Threads[sName]  = self;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cThread:start(iMS)&lt;br /&gt;
    self.thread = coroutine.create(self.func)&lt;br /&gt;
    self.yields = 0;&lt;br /&gt;
&lt;br /&gt;
    self.lastTickCount  = getTickCount();&lt;br /&gt;
&lt;br /&gt;
    self:resume()&lt;br /&gt;
&lt;br /&gt;
    self.timer  = setTimer(function()&lt;br /&gt;
        if(self:status() == &amp;quot;suspended&amp;quot;) then&lt;br /&gt;
            if(getTickCount()-self.lastTickCount &amp;gt; 5000) then&lt;br /&gt;
                self.lastTickCount = getTickCount();&lt;br /&gt;
 --             outputConsole(&amp;quot;[THREAD: &amp;quot;..self.name..&amp;quot;] Current Yields: &amp;quot;..self.yields);&lt;br /&gt;
            end&lt;br /&gt;
            for i = 1, self.iAmmounts, 1 do&lt;br /&gt;
                self.yields = self.yields+1;&lt;br /&gt;
                self:resume();&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if(self:status() == &amp;quot;dead&amp;quot;) then&lt;br /&gt;
            killTimer(self.timer);&lt;br /&gt;
            self:stop()&lt;br /&gt;
        end&lt;br /&gt;
    end, iMS, -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cThread:resume()&lt;br /&gt;
    coroutine.resume(self.thread)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cThread:stop()&lt;br /&gt;
    self.thread = nil&lt;br /&gt;
&lt;br /&gt;
--  outputConsole(&amp;quot;[THREAD: &amp;quot;..self.name..&amp;quot;] Completed, Yields: &amp;quot;..self.yields);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cThread:status()&lt;br /&gt;
    return coroutine.status(self.thread)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example shows an UserVehicleManager class combined with a Thread which loads all vehicles from a specific database table on server startup.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local CUserVehicleManager = inherit(cSingleton)&lt;br /&gt;
&lt;br /&gt;
function CUserVehicleManager:createVehicles()&lt;br /&gt;
    local result = CDatabase:getInstance():query(&amp;quot;SELECT * FROM user_vehicles;&amp;quot;)           -- Big amount of data (&amp;gt; 10000 rows)&lt;br /&gt;
    if(result) and (#result &amp;gt; 0) then       -- Are there any vehicles?&lt;br /&gt;
        for index, row in pairs(result) do  -- Loop through the resultset&lt;br /&gt;
            Vehicle(unpack(row));           -- Create the Vehicle&lt;br /&gt;
            coroutine.yield()               -- Yield back to the thread manager, without the coroutine, the script will abort the loop (infinite running script)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function CUserVehicleManager:constructor()&lt;br /&gt;
    self.loadFunc		= function() self:createVehicles() end      -- The coroutine main loop function&lt;br /&gt;
    self.thread			= cThread:new(&amp;quot;User Vehicle Loading Thread&amp;quot;, self.loadFunc, 5) -- Limit to 5 yields / call&lt;br /&gt;
    self.thread:start(50);                                          -- Begin the loading process, limited to 5 yields / 50 miliseconds&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Classes}}&lt;/div&gt;</summary>
		<author><name>MuLTi</name></author>
	</entry>
</feed>