Implement thread cancellation for aarch64

This commit is contained in:
Justine Tunney 2023-09-07 08:29:16 -07:00
parent dcda6f7d8d
commit 032b1f3449
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
54 changed files with 297 additions and 167 deletions

View file

@ -16,19 +16,18 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/atomic.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/dll.h"
#include "libc/runtime/runtime.h"
#include "libc/thread/posixthread.internal.h"
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#include "third_party/dlmalloc/dlmalloc.h"
/**
* Releases memory of detached threads that have terminated.
*/
void pthread_decimate_np(void) {
bool empty;
struct Dll *e;
struct PosixThread *pt;
enum PosixThreadStatus status;
@ -46,9 +45,5 @@ StartOver:
goto StartOver;
}
}
empty = dll_is_empty(_pthread_list);
pthread_spin_unlock(&_pthread_lock);
if (empty) {
dlmalloc_trim(0);
}
}