Commit 5c32624
Use ZendMM in ext-gmp
While libgmp uses true globals to track the allocator, and is therefore
not safe to use in a threaded environment, we can make use of a
thread-local variable that indicates whether the current thread is
currently performing a PHP request. We set this TLS global to true if it
is in RINIT, and set it to false in post-RSHUTDOWN. This ensures that
any (de)allocation during the request will go through ZendMM while
keeping it possible for this thread to be reused or for other threads
using libgmp.
Co-authored-by: "Christoph M. Becker" <[email protected]>1 parent bfca4c7 commit 5c32624
2 files changed
+57
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
521 | 531 | | |
522 | 532 | | |
523 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
524 | 561 | | |
525 | 562 | | |
526 | 563 | | |
| |||
551 | 588 | | |
552 | 589 | | |
553 | 590 | | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
554 | 594 | | |
555 | 595 | | |
556 | 596 | | |
557 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
558 | 604 | | |
559 | 605 | | |
560 | 606 | | |
| |||
567 | 613 | | |
568 | 614 | | |
569 | 615 | | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
570 | 623 | | |
571 | 624 | | |
572 | 625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
0 commit comments