Thread.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Thread" inherits="Reference" category="Core" version="3.1.2">
  3. <brief_description>
  4. A unit of execution in a process.
  5. </brief_description>
  6. <description>
  7. A unit of execution in a process. Can run methods on [Object]s simultaneously. The use of synchronization via [Mutex], [Semaphore] is advised if working with shared objects.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="get_id" qualifiers="const">
  13. <return type="String">
  14. </return>
  15. <description>
  16. Returns the current [code]Thread[/code]s id, uniquely identifying it among all threads.
  17. </description>
  18. </method>
  19. <method name="is_active" qualifiers="const">
  20. <return type="bool">
  21. </return>
  22. <description>
  23. Returns [code]true[/code] if this [code]Thread[/code] is currently active. An active [code]Thread[/code] cannot start work on a new method but can be joined with [method wait_to_finish].
  24. </description>
  25. </method>
  26. <method name="start">
  27. <return type="int" enum="Error">
  28. </return>
  29. <argument index="0" name="instance" type="Object">
  30. </argument>
  31. <argument index="1" name="method" type="String">
  32. </argument>
  33. <argument index="2" name="userdata" type="Variant" default="null">
  34. </argument>
  35. <argument index="3" name="priority" type="int" default="1">
  36. </argument>
  37. <description>
  38. Starts a new [code]Thread[/code] that runs "method" on object "instance" with "userdata" passed as an argument. The "priority" of the [code]Thread[/code] can be changed by passing a PRIORITY_* enum.
  39. Returns OK on success, or ERR_CANT_CREATE on failure.
  40. </description>
  41. </method>
  42. <method name="wait_to_finish">
  43. <return type="Variant">
  44. </return>
  45. <description>
  46. Joins the [code]Thread[/code] and waits for it to finish. Returns what the method called returned.
  47. </description>
  48. </method>
  49. </methods>
  50. <constants>
  51. <constant name="PRIORITY_LOW" value="0" enum="Priority">
  52. </constant>
  53. <constant name="PRIORITY_NORMAL" value="1" enum="Priority">
  54. </constant>
  55. <constant name="PRIORITY_HIGH" value="2" enum="Priority">
  56. </constant>
  57. </constants>
  58. </class>