MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SpawnThread

Method SpawnThread

src/linkgraph/linkgraphjob.cpp:59–71  ·  view source on GitHub ↗

* Spawn a thread if possible and run the link graph job in the thread. If * that's not possible run the job right now in the current thread. */

Source from the content-addressed store, hash-verified

57 * that's not possible run the job right now in the current thread.
58 */
59void LinkGraphJob::SpawnThread()
60{
61 if (!StartNewThread(&this->thread, "ottd:linkgraph", &(LinkGraphSchedule::Run), this)) {
62 /* Of course this will hang a bit.
63 * On the other hand, if you want to play games which make this hang noticeably
64 * on a platform without threads then you'll probably get other problems first.
65 * OK:
66 * If someone comes and tells me that this hangs for them, I'll implement a
67 * smaller grained "Step" method for all handlers and add some more ticks where
68 * "Step" is called. No problem in principle. */
69 LinkGraphSchedule::Run(this);
70 }
71}
72
73/**
74 * Join the calling thread with this job's thread if threading is enabled.

Callers 2

SpawnNextMethod · 0.80
SpawnAllMethod · 0.80

Calls 1

StartNewThreadFunction · 0.85

Tested by

no test coverage detected