Back



MightyMax.org



 

 

Multithreading example/lib code 


Hi there,

you can grab the multithreading sources here

 

 

Little list of features / functions:

  • Critical Sections, which will not be interrupted by a thread shedule:
    • EnterCriticalSection()
    • LeaveCriticalSection()
  • Statistical functions:
    • GetThreadCount(GTC_ALL | GTC_RUNNING | GTC_AVAILABLE)
  • ThreadControl (self targeted):
    • ThreadWait() - suspends thread till IRQ occurred
    • EndCurrentThread(value) - ends thread and sets a return value
  • ThreadControl (other threads):
    • CreateThread(entry,stack) - creates & starts a new thread (returns threadID)
    • KillThread(threadID) - kills a thread
    • GetThreadStatus(threadID)
    • SetThreadStatus(threadID)
    • GetThreadReturnValue(threadID)
  • Semaphores
    • Semaphores are using suspend-resume-queuing :
    • CreateSemaphore()
    • AquireSemaphore(semaphore)
    • ReleaseSemaphore(semaphore)
  • IRQ:

Since the IRQ handler is captured, you can set a custom IRQ Handler now by

    • SetIRQHandler(handler)

 

  • All threads of status THREAD_STATUS_RUNNING are sheduled cyclic on 33kHz
    or any occured IRQ (Timer3 is reserved)


 

 

 

Due to german law i have to add an impressum:

Impressum:
Die Seite wird (privat) unterhalten von
Tim Seidel
Gartenstrasse 54
56064 Aachen

Tel.: 0179/1075508
Mail.: seidelt@gmx.de