This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
import threading | |
from typing import Generator | |
# Author : github.com/Eboubaker | |
# Fixed by: github.com/icezyclon | |
class ReentrantRWLock: | |
"""This class implements reentrant read-write lock objects. | |
A read-write lock can be aquired in read mode or in write mode or both. | |
Many different readers are allowed while no thread holds the write lock. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//js | |
$('.j-spoiler').each(function(){ | |
new Spoiler(this); | |
}); | |
Spoiler = function(container) { | |
this.container = $(container); | |
this.head = this.container.find('.j-spoiler-head'); | |
this.body = this.container.find('.j-spoiler-body'); | |
this.close = this.container.find('.j-spoiler-close'); | |
this.init(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" rwlock.py | |
A class to implement read-write locks on top of the standard threading | |
library. | |
This is implemented with two mutexes (threading.Lock instances) as per this | |
wikipedia pseudocode: | |
https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes |